Can somebody tell me how to solve this question? I have already seen the Editorial but still could not able to comprehend the approach used as square root decomposition.
If anyone have another better approach apart from this Editorial or have a better explanation of that editorial then you are welcome to present here!
i have done this question in an easy way.what i did is calculating all possible rectangle sizes,sorting by area and then searching downwards,if i come accross a valid rectangle then i print the answer and exit.
here is my submission link
feel free to comment if you have any doubt
Please try to explain your approach in a lenient way.
Isn’t this an N^2 * M^2 approach? Note that N^2*M^2 approach also fetches full points if optimisations are made and also due to weak test cases. Moreover, it is difficult to make a strong test case to this, cause there are only 10 digits.
1 Like
i think there’s guaranteed to be a larger palindromic rectangle in a very large grid
LOL! I thought of a similar solution but didn’t submit it, thinking it won’t pass within the time limit.
1 Like