Wa in Find it ques

my sol : https://ide.codingblocks.com/s/240708

ques : https://hack.codingblocks.com/app/contests/1463/141/problem

i m not able to find any error in my sol, the sample tc is giving correct ans too. But all tcs are giving wa on hackerblocks

Pls help me out


hey, this uses similar logic just handles for k=1 case and precomputes for all states and it passes

ya … okk i missed n = 1. thnx for help