Regarding using recursion or not

How to get that it is recursion problem and can not be solved optimally using any algorithm.

You can see constraints to see whether it is only a recursion problem or not.
Basically in 1 sec= 10^8 computation can be done.
Normally , n=22, then in recursion O(2^n) is fairly 10^8 computation .
So , if n<=22 , then your brute forces O(2^n) recursion will work otherwise you have to find optimizations.
If n=10^8 then O(n) complexity needed
if n=10^6 then O(n logn) can work
if n=10^4 then O(n^2) will work.
So, according to constraint you can see the required complexity of a problem.
Hit like if u get it :slight_smile:

1 Like