Please share your approach for cooking game in February cookoff. asked 20 Feb '17, 00:11

put arr[1] = 1 , if arr[i] = 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). answered 20 Feb '17, 00:23

First of all for all i's(stating from i=n) such that a[i+1]>1, set a[i]=a[i+1]1 if it is 1 or a[i+1]1.else array is invalid. Second checked if a[i]=1or1 if it is anything else array is invalid.set a[i]=1 now every a[i]=1 can be changed to a[i1]+1 or 1.(2 possibilities for every such i) so final answer is 2^x.(x=no. of i's such that a[i]=1). if array is invalid answer is 0. answered 20 Feb '17, 00:30

First of all for all i's such that a[i+1]>1, set a[i]=a[i+1]1 if it is 1 or a[i+1]1.else array is invalid. Second checked if a[i]=1or1 if it is anything else array is invalid.set a[i]=1 now every a[i]=1 can be changed to a[i1]+1 or 1.(2 possibilities for every such i) so final answer is 2^x.(x=no. of i's such that a[i]=1). if array is invalid answer is 0. answered 20 Feb '17, 00:30
