Approach for Cooking Game

short-contest

#1

Please share your approach for cooking game in February cook-off.


#2

put arr[1] = 1 , if arr* = x , then put arr[i - 1] = x - 1 , arr[i - 2] = x - 2 … till it becomes 1 , now answer is just 2 ^ (count of -1’s).