Runtime in some test cases

Your solution is not passing because of the Exception in thread β€œmain” java.lang.OutOfMemoryError: Java heap space at Main.(Main.java:3).
You may either create a single 1-D array to solve this problem or create a runnable thread and increase your heap size.

You may have a look at this post for reference.
https://codeforces.com/blog/entry/166

https://www.tutorialspoint.com/how-to-change-increase-the-heap-size-of-the-java-virtual-machine-in-java

https://ide.codingblocks.com/s/282022 You may have a look at this code for reference.

Oh , Thanks you sir :slight_smile: