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

GOOGLE CODING INTERVIEW QUESTION - BAG OF TOKENS

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 Google's most commonly asked interview questions according to LeetCode (2020)! Google coding interview question, bag of tokens, coding solution. If you give me 5 minutes you'll thank me if this appears during your Google interview! Coding Interviews bag of tokens (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: Google

Link to problem: https://leetcode.com/problems/bag-of-tokens/

Intuition behind solution: Greedily get coins whenever possible. Sort the array to always know the smallest token and largest tokens by using two pointers. Iterate through the array of tokens while your two pointers haven't crossed. At every iteration, get a point if possible (if you have enough power for the smallest token). If you can't get a point, but you have a point to give, give in that point for the most amount of power available (largest token). If you cannot get a point and don't have any points, return the max number of points you've received throughout the game.

MUSIC
----------------------------------------------------------------------------------------------------------------
Off the balm+ by Lo-Kage
https://soundcloud.com/halflithalfwit/balm

#techinterviews #leetcode #googleinterview

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

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

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

Зарегистрируйтесь или войдите с
Информация о видео
22 февраля 2020 г. 22:00:01
00:09:58
Яндекс.Метрика