Hackerrank: Sherlock and the Valid String

preview_player
Показать описание
Sherlock and the Valid String step by step solution.
Github:

Problem:

powerpoint:
Рекомендации по теме
Комментарии
Автор

Can you explain the if(min == 1 && sameAsMin == 1) return "YES" line. I don't understand why min == 1 here, can't the min value be anything? I thought what mattered was that max-min == 1.

laibamustafa
Автор

when I used if else if instead of if if, I got 5 failed. Can you explain why this happened?

TS-ybxe