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

Автор hulk_baba, история, 8 лет назад, По-английски

Please go through this problem 716B. My idea is : 1. if length of string in less than 26 , print "-1" and return ; 2. calculate frequency of first 26 characters and then see how many characters are left out and how many '?' are available . 3. If left out == cnt['?'] it is possible. 4. If not go for next 26. 4. I tried it but failed on 18th test case here? Could you help me with my implementation. Or if you have more elegant implementation please suggest me.

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

»
8 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

In m u maintain amount of symbols on suffix, not on a substring. If i understood correctly

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

here u are ..
link for your accepted code
what you were doing wrong was mapping all the characters of the string in one go rather than dealing with substring of length 26.
just have a look to changes i made.
i cannot say whether mine is elegant or not.
but you can refer mine too link for my accepted code