KTH LARGEST SUM IN A BINARY TREE | LEETCODE 2583 | PYTHON BFS SOLUTION

  Рет қаралды 706

Cracking FAANG

Cracking FAANG

Күн бұрын

Пікірлер: 4
@ning4411
@ning4411 Ай бұрын
I don't think time complexity is correct here. The loop is O(N), and inside the loop, and for each node, it requires one heappush and at most one heapop, which is O(2logK), and the total time complexity is O(N*logK). H in time complexity is redundant, one counter example if the tree is skewed, and the time compexity is O(n^2*logk), which could not be true.
@sandeeptukaram6539
@sandeeptukaram6539 9 күн бұрын
instead of heap O(NlgN), quicksort would serve better O(lgN)
@LJLJ-m1j
@LJLJ-m1j 27 күн бұрын
Can you solve #2663 ?
Diameter of Binary Tree - Leetcode 543 - Python
7:26
NeetCodeIO
Рет қаралды 34 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 9 МЛН
Увеличили моцареллу для @Lorenzo.bagnati
00:48
Кушать Хочу
Рет қаралды 9 МЛН
He wrote this out BY HAND? // Code Review
24:01
The Cherno
Рет қаралды 196 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 593 М.
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Codebagel
Рет қаралды 305 М.
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 6 М.
Maximum Width of Binary Tree - Leetcode 662 - Python
11:38
NeetCodeIO
Рет қаралды 21 М.
Kth Largest Sum in a Binary Tree - Leetcode 2583 - Python
9:50
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 9 МЛН