ProjectEuler+ Contest Problem Statement

This is the "Largest Product in a grid" Problem of HackerRank, it was a fairly interesting problem which made me think about the corner cases for about 45 mins, it basically used the concepts of accessing a 2D Array elements, the last corner case was soo tricky to find, and I was starting to think that there must be some problem from the site only because it felt so clear to me. I was confused about how can I miss anything in this problem but I did miss the case of the elems of all left diagonals, which is the last case that I had covered in the code, I had converted this into the form of a function.

Originally the code mentioned below was inside the main function, but for the sake of simplicity I mentioned it as a func. Often it happens that the code of the HackerRank site makes it difficult to understand what's happening... but I think we should try to grok it. Well this is the power of C++, that is it's speed... so many iterations but still all test cases time limit accepted, we can put more conditions in the first loops to make the code more compact but I am not doing that currently because it's 11:56 of night and I am feeling sleepy, so I'll hit the hay...

Peace!
 

Comments

Popular Posts