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

GOOGLE - BOATS TO SAVE PEOPLE (LeetCode)

This is one of Google's most commonly asked interview questions according to LeetCode (2019)! Boats to Save People coding solution. If you give me 5 minutes you'll thank me if this appears during your interview! Coding Interviews Boats to Save People (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/boats-to-save-people/

Intuition behind solution: Sort the array of people. Iterate through the people with a pointer i starting at the first person (lightest) and a pointer j starting at the last person (heaviest) Greedily try and either...
1. Pair the heaviest and lightest person together in a boat (increment i and decrement j)
2. Simply take the heaviest in a boat alone (only decrement j)
and then increment the number of boats used. Once i and j cross, return the number of boats you have used.

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

MUSIC
----------------------------------------------------------------------------------------------------------------
uwu popped a bean by star printer
https://soundcloud.com/star-printer/uwu-popped-a-bean

#coding #interviews #softwareengineering

Видео GOOGLE - BOATS TO SAVE PEOPLE (LeetCode) канала Kevin Naughton Jr.
Показать
Комментарии отсутствуют
Введите заголовок:

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

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

Зарегистрируйтесь или войдите с
Информация о видео
9 апреля 2019 г. 6:52:20
00:07:06
Яндекс.Метрика