https://www.codechef.com/problems/NEU004/

I was working with problem https://www.codechef.com/problems/NEU004/ and I’m feeling stuck. The DP approach O(n) will be giving TLE. The question demands a O(log(n)) or O(1) approach.

1 Like