Game Of Tiles
Anonymous User
1367

There is a sequence of tiles. Each tile will have a three numbers on it. In that tiles you can do following operations
let say tiles will have a numbers like this a0,b0,c0,a1,b1,c1,......an,bn,cn

  1. If you are choosing a tile with leftmost number a0, you can go to the next tile of the sequence like without skipping any tile
  2. if you are choosing a tile with middle number, you have to skip the next sequence. You have to process the i+2 th tile.
  3. if you are choosing a tile with right number, you have to skip the next two sequence. You have to process the i+3 th tile.

By picking the numbers, you have to maximize the sum of these elements.

Input:
number of tiles : 4
2 3 1
7 9 8
4 5 6
2 3 22

output : 35

explanation : if we choose left element from first 3 tiles and getting a right element from fourth tile we can get the maximum sum

Comments (1)