Skip to content

Commit

Permalink
update progress
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Jun 7, 2024
1 parent fd6d741 commit 4683a57
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 18 deletions.
3 changes: 2 additions & 1 deletion data/progress.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
20240607: 235(ok),236(again),496(again!!!),503,110(ok)
20240608: 503,739
20240607: 235(ok),236(again),496(again!!!),110(ok),1448(again!)
20240606: 206,143,138(again),141,needcode_tree,226,104,110(again!!!)
20240605: 150,22(again),739(again!!!),needcode_linkedlist
20240604: 567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)
Expand Down
34 changes: 17 additions & 17 deletions data/to_review.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2024-08-01 -> ['235(ok),236(again),496(again!!!),503,110(ok)']
2024-08-01 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)']
2024-07-31 -> ['206,143,138(again),141,needcode_tree,226,104,110(again!!!)']
2024-07-30 -> ['150,22(again),739(again!!!),needcode_linkedlist']
2024-07-29 -> ['567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)']
Expand All @@ -18,7 +18,7 @@
2024-07-14 -> ['73,200,70,323(again)']
2024-07-13 -> ['207,79,206,213,198']
2024-07-12 -> ['212(todo),211,338,208(again)']
2024-07-11 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '347,253(todo),91(todo),217']
2024-07-11 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '347,253(todo),91(todo),217']
2024-07-10 -> ['206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '226,98,253(todo)']
2024-07-09 -> ['150,22(again),739(again!!!),needcode_linkedlist', '104,230,102,100']
2024-07-08 -> ['567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '105,106']
Expand All @@ -30,27 +30,27 @@
2024-07-01 -> ['143,15,268,141,139']
2024-06-30 -> ['21,20,19,271,269']
2024-06-29 -> ['417(again),33,153,152']
2024-06-28 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '424,297(todo),295(todo),39']
2024-06-28 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '424,297(todo),295(todo),39']
2024-06-27 -> ['206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '55,54(todo),53(again),435(again),49,48(todo),300(again)']
2024-06-26 -> ['150,22(again),739(again!!!),needcode_linkedlist', '56']
2024-06-25 -> ['567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '62,572,57']
2024-06-24 -> ['146,460,582(ok*),139(ok),322(todo)', '322,191,190']
2024-06-23 -> ['127,742(again),133(again),207(ok*),261(ok)', '73,200,70,323(again)']
2024-06-22 -> ['128,261', '207,79,206,213,198']
2024-06-21 -> ['005,003(again)', '212(todo),211,338,208(again)']
2024-06-20 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '347,253(todo),91(todo),217']
2024-06-20 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '347,253(todo),91(todo),217']
2024-06-19 -> ['206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '11,647,261(again),133(again)', '226,98,253(todo)']
2024-06-18 -> ['150,22(again),739(again!!!),needcode_linkedlist', '143,15,268,141,139', '104,230,102,100']
2024-06-17 -> ['567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '21,20,19,271,269', '105,106']
2024-06-16 -> ['146,460,582(ok*),139(ok),322(todo)', '417(again),33,153,152', '242,235']
2024-06-15 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '127,742(again),133(again),207(ok*),261(ok)', '424,297(todo),295(todo),39', '371']
2024-06-15 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '127,742(again),133(again),207(ok*),261(ok)', '424,297(todo),295(todo),39', '371']
2024-06-14 -> ['206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '128,261', '55,54(todo),53(again),435(again),49,48(todo),300(again)', '121,252']
2024-06-13 -> ['150,22(again),739(again!!!),needcode_linkedlist', '005,003(again)', '56', '125']
2024-06-12 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '62,572,57']
2024-06-12 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '62,572,57']
2024-06-11 -> ['206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '146,460,582(ok*),139(ok),322(todo)', '11,647,261(again),133(again)', '322,191,190']
2024-06-10 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '150,22(again),739(again!!!),needcode_linkedlist', '127,742(again),133(again),207(ok*),261(ok)', '143,15,268,141,139', '73,200,70,323(again)']
2024-06-09 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '128,261', '21,20,19,271,269', '207,79,206,213,198']
2024-06-08 -> ['235(ok),236(again),496(again!!!),503,110(ok)', '206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '150,22(again),739(again!!!),needcode_linkedlist', '146,460,582(ok*),139(ok),322(todo)', '005,003(again)', '417(again),33,153,152', '212(todo),211,338,208(again)']
2024-06-10 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '150,22(again),739(again!!!),needcode_linkedlist', '127,742(again),133(again),207(ok*),261(ok)', '143,15,268,141,139', '73,200,70,323(again)']
2024-06-09 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '128,261', '21,20,19,271,269', '207,79,206,213,198']
2024-06-08 -> ['235(ok),236(again),496(again!!!),110(ok),1448(again!)', '206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '150,22(again),739(again!!!),needcode_linkedlist', '146,460,582(ok*),139(ok),322(todo)', '005,003(again)', '417(again),33,153,152', '212(todo),211,338,208(again)']
2024-06-07 -> ['206,143,138(again),141,needcode_tree,226,104,110(again!!!)', '150,22(again),739(again!!!),needcode_linkedlist', '567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '127,742(again),133(again),207(ok*),261(ok)', '424,297(todo),295(todo),39', '347,253(todo),91(todo),217']
2024-06-06 -> ['150,22(again),739(again!!!),needcode_linkedlist', '567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '146,460,582(ok*),139(ok),322(todo)', '128,261', '11,647,261(again),133(again)', '55,54(todo),53(again),435(again),49,48(todo),300(again)', '226,98,253(todo)']
2024-06-05 -> ['567(todo),needcode_array_hash,needcode_sliding_window,567(again),needcode_stack,155(again)', '146,460,582(ok*),139(ok),322(todo)', '127,742(again),133(again),207(ok*),261(ok)', '005,003(again)', '143,15,268,141,139', '56', '104,230,102,100']
Expand Down Expand Up @@ -484,7 +484,7 @@
2022-06-11 -> ['529,547', '1162', '371,124', '323,034', '010,056,314,311,277']
2022-06-10 -> ['1162', '787', '1011,1597', '131,96', '062,152,079,212', '721,825,032,071']
2022-06-09 -> ['1162', '787', '311,334,498,101']
2022-06-08 -> ['787', '1011,1597', '503,739']
2022-06-08 -> ['503,739', '787', '1011,1597']
2022-06-07 -> ['1011,1597', '131,96', '1152,2021,1151,1963,2104,098,110,116,117,669']
2022-06-06 -> ['1011,1597', '371,124', '322,213', '067,459,647,696,791,796,622,088,179,253,937,1710', '263,264,703,496,503']
2022-06-05 -> ['131,96', '062,152,079,212', '323,1143,322', '092,173,394,735,1353,1481,231']
Expand All @@ -505,7 +505,7 @@
2022-05-21 -> ['658,759,1027', '010,056,314,311,277', '735,048,504,1022,257,1963,080,227,207']
2022-05-20 -> ['323,1143,322', '034', '370,033,081', '721,825,032,071', '1022,045,588,1166']
2022-05-19 -> ['277,289', '311,334,498,101', '015,504,048,1209,1047']
2022-05-18 -> ['323,1143,322', '503,739']
2022-05-18 -> ['503,739', '323,1143,322']
2022-05-17 -> ['323,1143,322', '034', '1152,2021,1151,1963,2104,098,110,116,117,669', '240,251', '1963,025']
2022-05-16 -> ['323,1143,322', '067,459,647,696,791,796,622,088,179,253,937,1710', '989,157,189,346,281', '263,264,703,496,503']
2022-05-15 -> ['034', '092,173,394,735,1353,1481,231', '403,1889']
Expand All @@ -518,26 +518,26 @@
2022-05-08 -> ['067,459,647,696,791,796,622,088,179,253,937,1710', '658,759,1027', '989,157,189,346,281', '010,056,314,311,277', '876,206,143']
2022-05-07 -> ['1152,2021,1151,1963,2104,098,110,116,117,669', '092,173,394,735,1353,1481,231', '370,033,081', '721,825,032,071', '003,140']
2022-05-06 -> ['1152,2021,1151,1963,2104,098,110,116,117,669', '067,459,647,696,791,796,622,088,179,253,937,1710', '1041,024,101,150,155', '277,289', '041,048,503', '311,334,498,101', '016,027,031,034', '815,297']
2022-05-05 -> ['1152,2021,1151,1963,2104,098,110,116,117,669', '067,459,647,696,791,796,622,088,179,253,937,1710', '092,173,394,735,1353,1481,231', '658,759,1027', '005,739', '503,739', '300', '669,1353,143,330,2021,207,417']
2022-05-05 -> ['503,739', '1152,2021,1151,1963,2104,098,110,116,117,669', '067,459,647,696,791,796,622,088,179,253,937,1710', '092,173,394,735,1353,1481,231', '658,759,1027', '005,739', '300', '669,1353,143,330,2021,207,417']
2022-05-04 -> ['067,459,647,696,791,796,622,088,179,253,937,1710', '092,173,394,735,1353,1481,231', '1041,024,101,150,155', '370,033,081', '240,251', '005', '131,875,048', '053,091,353,348']
2022-05-03 -> ['092,173,394,735,1353,1481,231', '1041,024,101,150,155', '658,759,1027', '277,289', '989,157,189,346,281', '263,264,703,496,503', '482,449,1603', '694,1915']
2022-05-02 -> ['1041,024,101,150,155', '658,759,1027', '370,033,081', '173,227,341,735,1047,161,415,647,680,791,281', '663,236,235,1963,1248,560,525', '1109,545,2021,040']
2022-05-01 -> ['658,759,1027', '370,033,081', '277,289', '240,251', '041,048,503', '325,438,463,523,525,554', '1481', '168,969,696', '207,1135,1703']
2022-04-30 -> ['370,033,081', '277,289', '989,157,189,346,281', '005,739', '010,056,314,311,277', '300,670,1353', '735,048,504,1022,257,1963,080,227,207', '1248,828,139,1372']
2022-04-29 -> ['277,289', '240,251', '005', '721,825,032,071', '300,670', '1022,045,588,1166', '1567,012,013,863,926,370']
2022-04-28 -> ['240,251', '989,157,189,346,281', '041,048,503', '311,334,498,101', '015,504,048,1209,1047', '1041,1339,140,133,139']
2022-04-27 -> ['240,251', '989,157,189,346,281', '005,739', '173,227,341,735,1047,161,415,647,680,791,281', '503,739', '1010,767,079,582']
2022-04-27 -> ['503,739', '240,251', '989,157,189,346,281', '005,739', '173,227,341,735,1047,161,415,647,680,791,281', '1010,767,079,582']
2022-04-26 -> ['989,157,189,346,281', '041,048,503', '005', '325,438,463,523,525,554', '1963,025', '139,140']
2022-04-25 -> ['041,048,503', '005,739', '010,056,314,311,277', '263,264,703,496,503']
2022-04-24 -> ['041,048,503', '005,739', '005', '173,227,341,735,1047,161,415,647,680,791,281', '721,825,032,071', '403,1889', '642,460,1481']
2022-04-23 -> ['005,739', '005', '325,438,463,523,525,554', '311,334,498,101', '1481', '016,027,031,034', '2009,895,227,224,080', '239,1375,089,190,735,696']
2022-04-22 -> ['005', '173,227,341,735,1047,161,415,647,680,791,281', '010,056,314,311,277', '503,739', '300,670,1353', '300', '588,1730,042']
2022-04-22 -> ['503,739', '005', '173,227,341,735,1047,161,415,647,680,791,281', '010,056,314,311,277', '300,670,1353', '300', '588,1730,042']
2022-04-21 -> ['173,227,341,735,1047,161,415,647,680,791,281', '325,438,463,523,525,554', '721,825,032,071', '300,670', '131,875,048', '926', '1151,2104,212,1648']
2022-04-20 -> ['173,227,341,735,1047,161,415,647,680,791,281', '325,438,463,523,525,554', '010,056,314,311,277', '311,334,498,101', '263,264,703,496,503', '482,449,1603', '017', '907,252,253,019']
2022-04-19 -> ['325,438,463,523,525,554', '010,056,314,311,277', '721,825,032,071', '503,739', '663,236,235,1963,1248,560,525', '1710,472']
2022-04-19 -> ['503,739', '325,438,463,523,525,554', '010,056,314,311,277', '721,825,032,071', '663,236,235,1963,1248,560,525', '1710,472']
2022-04-18 -> ['010,056,314,311,277', '721,825,032,071', '311,334,498,101', '1481', '168,969,696', '980,121,041,143,909', '370,393,113']
2022-04-17 -> ['721,825,032,071', '311,334,498,101', '503,739', '263,264,703,496,503', '300,670,1353', '735,048,504,1022,257,1963,080,227,207', '876,206,143', '1152,1492,146']
2022-04-16 -> ['311,334,498,101', '503,739', '300,670', '1022,045,588,1166', '003,140', '828,937,1268,926,696']
2022-04-17 -> ['503,739', '721,825,032,071', '311,334,498,101', '263,264,703,496,503', '300,670,1353', '735,048,504,1022,257,1963,080,227,207', '876,206,143', '1152,1492,146']
2022-04-16 -> ['503,739', '311,334,498,101', '300,670', '1022,045,588,1166', '003,140', '828,937,1268,926,696']
2022-04-15 -> ['503,739', '263,264,703,496,503', '1481', '016,027,031,034', '015,504,048,1209,1047', '815,297', '734,737,743,787,130']
2022-04-14 -> ['263,264,703,496,503', '300,670,1353', '300', '669,1353,143,330,2021,207,417', '686,298,127,126,133']
2022-04-13 -> ['263,264,703,496,503', '1481', '300,670', '131,875,048', '1963,025', '053,091,353,348', '308,269,206,079']
Expand Down
60 changes: 60 additions & 0 deletions leetcode_java/src/main/java/dev/workspace3.java
Original file line number Diff line number Diff line change
Expand Up @@ -4141,4 +4141,64 @@ public int[] nextGreaterElement(int[] nums1, int[] nums2) {
return ans;
}

// LC 1448
/**
* Given a binary tree root,
* a node X in the tree is named good if in the path
* from root to X there are no nodes with a value greater than X.
* Return the number of good nodes in the binary tree.
*
*
* NOTE : if in the path from root to X there are no nodes with a value greater than X.
*/

// dfs (post order) (left -> right -> root)
// step 1) go through nodes, collect path (root -> node)
// step 2) check if elements in path < X
// step 3) return res
int goodNodeCnt = 0;
public int goodNodes(TreeNode root) {

if (root == null){
return 0;
}

if (root.left == null && root.right == null){
return 1;
}

// dfs
//List<Integer> collected = new ArrayList<>();
this.isGoodNode(root, Integer.MIN_VALUE); // ?
return goodNodeCnt;
}

public void isGoodNode(TreeNode root, int maxSoFar){

if (root.val <= maxSoFar){
//return;
this.goodNodeCnt += 1;
}

if (root.left != null){
this.isGoodNode(root.left, Math.max(root.val, maxSoFar));
}

if (root.right != null){
this.isGoodNode(root.right, Math.max(root.val, maxSoFar));
}

//// if (root == null){
//// //return true; // ? already reach the end
//// }
//
// if (root.val <= cur.val){
// //return false;
// }
//
// return this.isGoodNode(root, cur.left, collected) &&
// this.isGoodNode(root, cur.right, collected);

}

}

0 comments on commit 4683a57

Please sign in to comment.