Can anyone please explain the time complexity of this problem.

# Time Complexity analysis

Time complexity is O(2^N), because for each element you have two choices you select or not.

**sanjay-jain**#3

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

i.e 2^(N+1)