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 :slight_smile:

1 Like

thankyou :slight_smile:

No problem
Please do like and give a rating