boodhu's blog

By boodhu, history, 6 weeks ago, In English

Hello. I was trying to solve the problem 716B - Дополни слово. 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.

  • Vote: I like it
  • -3
  • Vote: I do not like it

6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

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


  • »
    6 weeks ago, # ^ |
      Vote: I like it -13 Vote: I do not like it

    Waste of time ... newbies just want to be mouthfed ,

    I found the mistake before you , But I know that he will just add the lines correct the mistake and move on ..

    And what do i get : Thanks in Advance lolololol

    You'll get it when you become expert....

    Except one , none of the greys ever thanked me as a token appreciation ( Guess that's why they get downvoted )

  • »
    6 weeks ago, # ^ |
    Rev. 3   Vote: I like it +8 Vote: I do not like it