Can anyone please explain the time complexity of this problem.
Time complexity is O(2^N), because for each element you have two choices you select or not.
it will be O( 2^N+1) OR SIMPLY O(2^N)
it is 2^N +2^N-1 +2^N-2…+1
which is 2(2^N-1)
i.e 2* 2^N