Error: STACK SMASHING DETECTED
Hi chahat
You didn’t intialize the array b with all 0. you need to maintain the count in b[i] of elements having ith bit set.
correct code:
Hope it helps 
1 Like
thankyou 
No problem
Please do like and give a rating