I have used the same approach in Java, as the video editorial for the problem uses in CPP. Still, the outcome is a Time Limit Error, which isn’t the case in the editorial. Even my code almost matches that of the editorial line by line.
Here’s my code : CodeChef: Practical coding for everyone
Please note the following before going through the solution :
- I have used the variable ‘next’ instead of ‘rem’(remaining) used in editorial
- I have used the variable ‘currentSize’ instead of ‘pos’
- I have used a HashMap to store x and y in the form of key-value pairs
Please help me out