I am solving the Broken keyboard problem . I used the sliding window approach O(n) solution. but i’m getting wrong answer. Can anybody tell me where i went wrong ?. thanks in advance.
my solution: http://ideone.com/EiweVp
problem : spoj.com/problems/BROKEN/