File tree Expand file tree Collapse file tree 27 files changed +152
-140
lines changed 
s0104_maximum_depth_of_binary_tree 
s0105_construct_binary_tree_from_preorder_and_inorder_traversal 
s0114_flatten_binary_tree_to_linked_list 
s0121_best_time_to_buy_and_sell_stock 
s0124_binary_tree_maximum_path_sum 
s0128_longest_consecutive_sequence 
s0131_palindrome_partitioning 
s0138_copy_list_with_random_pointer 
s0142_linked_list_cycle_ii 
s0152_maximum_product_subarray 
s0153_find_minimum_in_rotated_sorted_array 
s0160_intersection_of_two_linked_lists 
s0206_reverse_linked_list 
s0208_implement_trie_prefix_tree 
s0215_kth_largest_element_in_an_array Expand file tree Collapse file tree 27 files changed +152
-140
lines changed Load Diff Large diffs are not rendered by default. 
Original file line number Diff line number Diff line change 22// #Tree #Binary_Tree #Data_Structure_I_Day_11_Tree 
33// #Programming_Skills_I_Day_10_Linked_List_and_Tree #Udemy_Tree_Stack_Queue 
44// #Top_Interview_150_Binary_Tree_General #Big_O_Time_O(N)_Space_O(H) 
5- // #2023_10_04_Time_51_ms_(97.14%)_Space_46.1_MB_(68.29 %) 
5+ // #2025_03_26_Time_0_ms_(100.00%)_Space_59.10_MB_(43.48 %) 
66
77import  {  TreeNode  }  from  '../../com_github_leetcode/treenode' 
88
Original file line number Diff line number Diff line change 11// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Tree #Binary_Tree 
22// #Divide_and_Conquer #Data_Structure_II_Day_15_Tree #Top_Interview_150_Binary_Tree_General 
3- // #Big_O_Time_O(N)_Space_O(N) #2023_10_04_Time_65_ms_(96.47%)_Space_45.9_MB_(80.00 %) 
3+ // #Big_O_Time_O(N)_Space_O(N) #2025_03_26_Time_2_ms_(93.38%)_Space_60.17_MB_(76.57 %) 
44
55import  {  TreeNode  }  from  '../../com_github_leetcode/treenode' 
66
Original file line number Diff line number Diff line change 11// #Medium #Top_100_Liked_Questions #Depth_First_Search #Tree #Binary_Tree #Stack #Linked_List 
22// #Udemy_Linked_List #Top_Interview_150_Binary_Tree_General #Big_O_Time_O(N)_Space_O(N) 
3- // #2023_10_04_Time_55_ms_(90.66%)_Space_45.8_MB_(12.11 %) 
3+ // #2025_03_26_Time_0_ms_(100.00%)_Space_58.93_MB_(15.60 %) 
44
55import  {  TreeNode  }  from  '../../com_github_leetcode/treenode' 
66
Original file line number Diff line number Diff line change 11// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming 
22// #Data_Structure_I_Day_3_Array #Dynamic_Programming_I_Day_7 #Level_1_Day_5_Greedy #Udemy_Arrays 
33// #Top_Interview_150_Array/String #Big_O_Time_O(N)_Space_O(1) 
4- // #2023_10_05_Time_56_ms_(99.56%)_Space_52.3_MB_(13.22 %) 
4+ // #2025_03_26_Time_1_ms_(96.44%)_Space_65.83_MB_(26.02 %) 
55
66function  maxProfit ( prices : number [ ] ) : number  { 
77    let  buyPrice  =  prices [ 0 ] 
Original file line number Diff line number Diff line change 11// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Dynamic_Programming #Depth_First_Search 
22// #Tree #Binary_Tree #Udemy_Tree_Stack_Queue #Top_Interview_150_Binary_Tree_General 
3- // #Big_O_Time_O(N)_Space_O(N) #2023_10_05_Time_61_ms_(96.73%)_Space_51.2_MB_(97.45 %) 
3+ // #Big_O_Time_O(N)_Space_O(N) #2025_03_26_Time_2_ms_(71.11%)_Space_65.59_MB_(42.96 %) 
44
55import  {  TreeNode  }  from  '../../com_github_leetcode/treenode' 
66
Original file line number Diff line number Diff line change 11// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Union_Find 
22// #Top_Interview_150_Hashmap #Big_O_Time_O(N_log_N)_Space_O(1) 
3- // #2023_10_05_Time_92_ms_(93.69%)_Space_64_MB_(30.13 %) 
3+ // #2025_03_26_Time_34_ms_(90.07%)_Space_82.70_MB_(18.54 %) 
44
55function  longestConsecutive ( nums : number [ ] ) : number  { 
6-     const  set  =  new  Set ( nums ) 
7-     let  max  =  0 
8-     for  ( const  num  of  nums )  { 
9-         if  ( set . has ( num  +  1 ) )  continue 
10-         let  counter  =  1 , 
11-             current  =  num 
12-         while  ( set . has ( -- current ) )  counter ++ 
13-         max  =  Math . max ( counter ,  max ) 
6+     let  sset  =  new  Set ( nums ) 
7+     let  maxLen  =  0 
8+     for  ( let  num  of  sset )  { 
9+         // check its start of the sequence 
10+         if  ( ! sset . has ( num - 1 ) )  { 
11+             let  len  =  0 ; 
12+             while  ( sset . has ( num + len ) )  { 
13+                 len  +=  1 
14+             } 
15+             maxLen  =  Math . max ( maxLen ,  len ) 
16+         } 
1417    } 
15-     return  max 
18+     return  maxLen 
1619} 
1720
1821export  {  longestConsecutive  } 
Original file line number Diff line number Diff line change 11// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #String #Dynamic_Programming 
22// #Backtracking #Big_O_Time_O(N*2^N)_Space_O(2^N*N) 
3- // #2023_10_05_Time_203_ms_(99.22%)_Space_81.9_MB_(42.19 %) 
3+ // #2025_03_26_Time_13_ms_(94.96%)_Space_82.19_MB_(40.76 %) 
44
55function  partition ( s : string ) : string [ ] [ ]  { 
66    const  ans : string [ ] [ ]  =  [ ] 
Original file line number Diff line number Diff line change 11// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Bit_Manipulation 
22// #Data_Structure_II_Day_1_Array #Algorithm_I_Day_14_Bit_Manipulation #Udemy_Integers 
33// #Top_Interview_150_Bit_Manipulation #Big_O_Time_O(N)_Space_O(1) 
4- // #2023_10_05_Time_56_ms_(85.48%)_Space_45.6_MB_(63.32 %) 
4+ // #2025_03_26_Time_1_ms_(78.27%)_Space_58.44_MB_(41.08 %) 
55
66function  singleNumber ( nums : number [ ] ) : number  { 
77    let  ans  =  0 
Original file line number Diff line number Diff line change 11// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Hash_Table #Linked_List 
22// #Programming_Skills_II_Day_14 #Udemy_Linked_List #Top_Interview_150_Linked_List 
3- // #Big_O_Time_O(N)_Space_O(N) #2023_10_06_Time_52_ms_(88.27%)_Space_44.7_MB_(72.42 %) 
3+ // #Big_O_Time_O(N)_Space_O(N) #2025_03_26_Time_49_ms_(72.42%)_Space_55.82_MB_(59.25 %) 
44
55import  {  Node  }  from  '../../com_github_leetcode/node' 
66
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments