Leetcode - Champagne Tower (Python)

preview_player
Показать описание
October 2020 Leetcode Challenge
Leetcode - Champagne Tower # 799

Edit: Time Complexity O(rows^2)
Space Complexity O (row)
Рекомендации по теме
Комментарии
Автор

Awesome as always. Time complexity will be O(R*R) where R is query_row. since for each row we are finding the champagne left in each glass for that row and the number of glasses is equal to row+1.

vikasviki
Автор

Hot Damn! I couldn't figure out how to keep track of the current row and the one below it! So I kept track of all the rows and simulated.

janmichaelaustria
Автор

Please can someone explain to me why poured=6, row=3, glass=1 = 0.25
Yes, it makes sense if I do calculations via pascals triangle but visually
row0= 1
row1= 2
row2 = 3
row3 = 4 glasses (how is the 4th glass getting anything when there are 6 before this).
Am I missing something??

ShivangiSingh-wcgk
visit shbcf.ru