Sherlock and the Valid String | HackerRank (Python)

Опубликовано: 21 Июнь 2021
на канале: Glitched Failure
239
3

CORRECTION: For the last check (10:38), the logic should also include a check that the count of counts for the LARGER number is 1. This is because we can only remove a character, not add one - so checking the absolute difference between the counts is not enough. For example, the string "aabbbcccddd" or {a:2, b:3, c:3, d:3} should be invalid. I've included this correction in my code (see link below).
CORRECTION: While the solution in the video passes all test cases, the logic could still be improved. Most notably for the case of "abb", which should return "YES". I've updated my solution to cover this case.

Challenge: https://www.hackerrank.com/challenges...

Code: https://gist.github.com/Shaddyjr/b0aa...

Intro: (0:00)
Solution: (1:21)

As a way to improve my coding skills and technical interview prep, I practice HackerRank, Code Wars, and Code Signal problems and solve them live with minimal edits. This allows viewers to see my thought process and problem-solving techniques along with the true struggles I go through when solving these technical coding problems. I also delve into tutorials about building out data structures, algorithms, and various other relevant and practical topics.

I mainly code in JavaScript, Python, and SQL. I also occasionally detour onto other challenges, like those from my own technical interviews, daily coding challenges, or just fun coding puzzles I come across.


Смотрите видео Sherlock and the Valid String | HackerRank (Python) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Glitched Failure 21 Июнь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 239 раз и оно понравилось 3 людям.