Algorithm for finding the maximum sum of the proper path with the rules in orthogonal triangle.
You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below;
- You will start from the top and move downwards to an adjacent number as in below.
- You are only allowed to walk downwards and diagonally.
- You can only walk over NON PRIME NUMBERS.
- You have to reach at the end of the pyramid as much as possible.
- You have to treat your input as pyramid.
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
- Currently if there is no path available it doesnt give an error. It should be implemented.
- Finding the prime algorithm can be improved by using another complex algorithms.
- Try and catch code blocks should be added in file read, input read and convertStringToTheIntMatrix functions.