3 ms·
Recursion in this case - generally in ruby as well - is not a great idea. Also, you have quite high memory requirements: O(n^2) O(n) is quite easy in this prob
by mbernstein 15y ago
Recursion in this case - generally in ruby as well - is not a great idea. Also, you have quite high memory requirements: O(n^2)
O(n) is quite easy in this problem.