My solution gets TLE. I use a memoized recursive function where the memoization table only has 512 entries.
EDIT: I changed my code to use StringBuilder to build up the output and output it all at once rather than System.out.println() and that fixed the TLE.
Search found 1 match
Search found 1 match • Page 1 of 1