Загрузка страницы

AMAZON CODING INTERVIEW QUESTION - REORGANIZE STRING

SOCIAL
----------------------------------------------------------------------------------------------------------------
Instagram: https://instagram.com/kevinnaughtonjr/
Twitter: https://twitter.com/KevinNaughtonJr
Patreon: https://www.patreon.com/KevinNaughtonJr
GitHub: https://github.com/kdn251

This is one of Amazon's most commonly asked interview questions according to LeetCode (2020)! reorganize string coding solution. If you give me 10 minutes you'll thank me if this appears during your Amazon interview! Coding Interviews reorganize string (LeetCode) question and explanation.

DISCORD CHANNEL
----------------------------------------------------------------------------------------------------------------
To join the Discord channel use the following link and join the "Member" tier: https://www.patreon.com/KevinNaughtonJr In this Discord channel, you will be able to...
1. Ask me questions directly (as well as other members)
2. Ask about and discuss previous interview experiences
3. Find mock interview partners
4. Share helpful videos for interview preparation, and more!

This question is commonly asked by the following companies: Amazon, Google, Facebook, and Microsoft.

Link to problem: https://leetcode.com/problems/reorganize-string/

Intuition behind solution: count the number occurrences of each character using a hash map. Create a max heap to hold the most frequently occurring character at its root at all times. While you have two elements in your heap, remove both characters and add them to your result string. Once your loop breaks, if the max heap has an element left in it and it occurs more than once, return the empty string, otherwise, append it to your result and return your result.

MUSIC
----------------------------------------------------------------------------------------------------------------
look alive, please by erickD
https://soundcloud.com/erickdie/look-alive-please

#techinterviews #leetcode #amazoninterview

Видео AMAZON CODING INTERVIEW QUESTION - REORGANIZE STRING канала Kevin Naughton Jr.
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
3 марта 2020 г. 7:00:03
00:12:44
Яндекс.Метрика