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

CODING INTERVIEW QUESTION - ASSIGN COOKIES

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

This is a commonly asked interview question according to LeetCode (2020)! assign cookies coding solution. If you give me 5 minutes you'll thank me if this appears during your interview! Coding Interviews assign cookies (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: ???

Link to problem: https://leetcode.com/problems/assign-cookies/

Intuition behind solution: sort both your arrays. Have one pointer to point at the largest cookie and one pointer to point at the greediest child. While both pointers are greater than or equal to 0, try to assign cookies. If you can give the ith cookie to the jth child, decrement both pointers and increment your return variable, content children. If you can't, i.e. the cookie is too small for the greedy child, try assigning that cookie to the next greedy child (which means decrement j). Once your loop breaks return your number of content children.

MUSIC
----------------------------------------------------------------------------------------------------------------
[this is america] by piep*
https://soundcloud.com/boypiep/this-is-america

#techinterviews #leetcode #codinginterview

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

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

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

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