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

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

Hello. I was trying to solve the problem 716B - Complete the Word. First of all, I confess that I have read the editorial and understood the solutions. I was trying to solve the question by the 2-pointer method.

My approach: Maintain 2 pointers, traverse through the input string while creating size-26 substrings starting at position-i. Check if all the 26 alphabets appear already or a sufficient number of q-marks are present to fill. If so, fill these and fill the rest of the q-marks by some letter(eg, 'A'). If no such substring is found, print "-1".

My logic seems to be correct. However, I am getting WA in test case: 44. I am not able to see the full input as the input string is quite large. Also, cf diagnostics could not detect any error(it usually suggests the type of error).

Can anyone please help me find the mistake in my code solution? PS: I know that it can be irritating to read other people's solutions. So I tried to make the code readable by adding a few comments and naming the variables relevantly.

My Solution: 89554794.

Thanks in Advance.

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

»
4 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

There is a small mistake in your code , Try this test case

A?BBCDEFGHIJKLMNOPQRSTUVWXYA?