Блог пользователя yaminote

Автор yaminote, история, 2 года назад, По-английски

I am getting WA on three of the test cases on following solution- https://www.codechef.com/viewsolution/54539476 My logic

If K is 0 and all indices are same then print N else -1; Now moving to when K>0 I check for each letter using a loop seeing what would be the answer if the given letter were remaining, I find the number of consecutive set of gaps in between the given letters. Now If gaps are less than or equal to K then the answer is the number of letters itself. Otherwise we are supposed to remove any of the (gaps-(k-1)) consecutive gaps and see how many of the given letter are removed in the process. Anything wrong with the approach?

  • Проголосовать: нравится
  • -4
  • Проголосовать: не нравится