Isn't this tricky for an easy problem?

Isn't this tricky for an easy problem?

Machine-readable: Markdown · JSON API · Site index

Поделиться Telegram VK Бот
Транскрипт Скачать .md
Анализ с AI

Оглавление (1 сегментов)

Segment 1 (00:00 - 00:00)

A duck walked up to a lemonade stand and he said to the men run in the stand lemonade costs $5 we're given a list of customers and the bill that each customer is going to pay with and our job is to give each of them the exact change for the first customer they give us a $5 bill we owe them zero change a second customer pays with five and then a third one pays with five next a customer pays with 10 so the change that we owe them is 10 - 5 so all we need to do is give them a $5 bill now we will have two $5 bills left and we actually have a $10 bill the last customer pays with a $20 bill so we owe them $15 luckily for us we have a $10 bill and at least one $5 bill just go through all the bills if we see a five increment the number of fives same thing with the $10 bills if the change is five we need to make sure we have at least five otherwise we return false and it works beautifully

Другие видео автора — NeetCode

Ctrl+V

Экстракт Знаний в Telegram

Экстракты и дистилляты из лучших YouTube-каналов — сразу после публикации.

Подписаться

Дайджест Экстрактов

Лучшие методички за неделю — каждый понедельник