Skip to content

korogluomer/Triangle-Max-Sum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Triangle-Max-Sum

You will have a TRIANGLE input from a file and you need to find the maximum sum of the numbers according to given rules below;

  1. You will start from the top and move downwards to an adjacent number as in below.
  2. You are only allowed to walk downwards and diagonally.
  3. You can only walk over NON PRIME NUMBERS.

According to above rules the maximum sum of the numbers from top to bottom in below example is 24.

  *1
 *8 4
2 *6 9

8 5 *9 3

As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9 1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the maximum sum.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages