Leetcode - Arranging Coins (Python)

preview_player
Показать описание
July 2020 Leetcode Challenge
Leetcode - Arranging Coins
Рекомендации по теме
Комментарии
Автор

U a math wizard. Didn't know Algebra 2 was going to be useful

edwardteach
Автор

This can also work : def arrangeCoins(self, n):
"""
:type n: int
:rtype: int
"""
row = 0
i = 0
while n > 0:
if n >= (i + 1):
row += 1
n = n - (i + 1)
i += 1
return row

poonamgulwane
Автор

Really bummed to have failed on this one during an interview... Did the first method you demonstrated, but failed the efficiency check when they passed a list of coins with each number in the millions.

Really appreciate how you took the time out to actually draw it out on a board and explain every step. Mad props!

usmanGTA
Автор

How does anyone come up with the binary search solution as well without having seen it??

mythbuster
Автор

I like this video because you are holding the white board through out the video is hilarious. Don't you have any chair or something to back it up? But the explanation is clear. Thank you

RizaHariati
visit shbcf.ru