Here's an iterative stack-based solution
There are lots of them, just think about the fact the power can't be very large.
I had the same time out problem. Did you find a solution?
Is there any elegant solution for this problem that doesn't time out? I only saw solutions with hardcoded limits and even with the hardcoded results. Thanks!
Javascript, both -3 and -5 are 1 unit away of -4
[ -7, 7, -1, -3, -9, -5, 1 ] -4 Expected: -5, instead got: -3
You may assume that each input would have exactly one solution.
That isn't true.
Is it possible to solve this problem without libraries or brute force?
In the samples I believe there's an error. It says:
get_textliterals("'this' is sample 'too'") -> [(0, 6), (15, 20)]
But it should be:
get_textliterals("'this' is sample 'too'") -> [(0, 6), (17, 22)]
That rectangle is 14x20, if the first square is 14x14, the second square cannot have a side bigger than 6
Loading collection data...
Here's an iterative stack-based solution
There are lots of them, just think about the fact the power can't be very large.
I had the same time out problem. Did you find a solution?
Is there any elegant solution for this problem that doesn't time out? I only saw solutions with hardcoded limits and even with the hardcoded results. Thanks!
Javascript, both -3 and -5 are 1 unit away of -4
That isn't true.
Is it possible to solve this problem without libraries or brute force?
In the samples I believe there's an error. It says:
But it should be:
That rectangle is 14x20, if the first square is 14x14, the second square cannot have a side bigger than 6