Any help would do…
Link to my code : github link
Can anybody help me to get an AC
I’ll check your code later…meanwhile…here is my short solution:—>
1)After some particular ‘k’, values will just keep repeating, you can that out by using the modulo operator,
2)For any, element, answer after ‘k’ rounds is :—> current element&(k-elements in left and k-elements in right), so do a range query for each element .
3)Make sure you make a cyclic segment tree, I mean this cyclic concept means just extending your array from size ‘n’ till it reaches ‘n-1’ again
if k > n then all elements become a&a&…a[n-1]
for other values of k implement a seg tree
If k>n/2… You may want to edit!!