Maximum Width Of Binary Tree

preview_player
Показать описание




.
.
.
Happy Programming !!! Pep it up 😍🤩
.
.
.
#pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive
Рекомендации по теме
Комментарии
Автор

Must say that this channel gives most logical intuition to any problem

hardikagarwal
Автор

I had submitted this question on leetcode...every time wrong output...after watching this video my it became crystal clear thank you very much Rajeesh Sir....Pepcoding nehi hota....barbad ho jate.

democratcobra
Автор

After trying for almost 2 days...I searched for solution & U explained it in just 10 minutes...Content Level🔥

raisanjeeb
Автор

boht hi shandaar logic hai array representation ko use krne ka yha

mickyman
Автор

can be done by using dfs and O(H) space

josephstark
Автор

This question on leetcode gives overflow with this logic!!

AbhishekMishra-memu
Автор

Sir please create some videos like how to get good placements and how to prepare other subjects other than dsa.

gauravgoyal
Автор

Is It the last vedio of level 2 ? Please do reply

anuragarora
Автор

using dfs :

public static int widthOfBinaryTree(TreeNode root) {
List<Integer> first_index = new ArrayList();
int max[] = new int[1];
dfs(root, first_index, 0, 0, max);
return max[0];
}
private static void dfs(TreeNode node, List<Integer> first_index, int curr_idx, int level, int max[]){
if(node==null) return;
if(level==first_index.size()) first_index.add(curr_idx);
max[0] = Math.max(max[0], curr_idx-first_index.get(level)+1);
dfs(node.left, first_index, 2*curr_idx+1, level+1, max);
dfs(node.right, first_index, 2*curr_idx+2, level+1, max);
}

LegitGamer
Автор

Thanks sir ...I continually following your channel....
When I try your code on leetcode then some test cases may fail....why ? I didn't getting...I observed So-many times....

examtips-iitian
Автор

add this video in the binary tree level-2 playlist

sujan_kumar_mitra
Автор

number overflow de raha hai c++ mein even for long long

maverickreal
Автор

Sir web dev ka course kb start hoga wapis?
Maine dusra course bich me chhodke ye wala start kiya tha or ab internships aagye or ye course Ruk gaya 😭

Please complete kara do roz 2-3 internships opportunities miss ho rhi hain 😭

gigachad