Tried a O(2^n * n^2) soln. Got TLE.
Then found a cpp soln online of O(2^n * n).
Implemented in java and got TLE .
Implemented in C and the same soln passed .
Tested both on ideone with n=16 .
c runtime = 0.03s
Why is there so much diff in runtimes of java and c ?
Is there a better approach to this problem (java passable) ??