Help in MYSARA

It is a question from recent march cook off
link to the question

I can’t find out what is wrong with my solution… after scratching my head for a long time… i am unable to find out any errors.

please , somebody, point out my mistake.

here is the link to the solution

use long long for ans : (ans * r) => will overflow

in line 20 set: res = arr[i] , not res = arr[i] | res

1 Like

thx bro…