I’ve tried to solve this problem, It was giving TLE. I reffered to doubts forum for optimized approach(in c++) and applied that in java. It is still giving TLE for 3 test cases. Is it due to the language java or c++, that same approach is accepted for one and not for the other?
Please help me out.
My solution : https://ide.codingblocks.com/s/230134
Reference: https://ide.codingblocks.com/s/138518?_ga=2.251000006.1334989375.1588653743-397636666.1585678639
