/leetcode-javascript

This contain solution of leetcode in javascript

Primary LanguageJavaScript

leetcode-javascript

LogoMakr_1PDRDt_1

This contain solution of leetcode in javascript

# Title Solution Runtime Memory Difficulty Time Complexity Space Complexity Explanation
709 To Lower Case Solution 72 ms 32.1 MB Easy
1 Two Sum two_sum.js 52 ms 35 MB Easy
811 Subdomain Visit Count subdomain_visit_count.js 80 ms 38.6 MB Easy
746 Min Cost Climbing Stairs Iterative 56 ms 34.8 MB Easy O(N) 🔗
1085 Sum of Digits in the Minimum Number Iterative 56 ms 34.9 MB Easy
674 Longest Continuous Increasing Subsequence Window Sliding Method 35.1 MB Easy
443 String Compression string_compression.js Easy
122 Best Time to Buy and Sell Stock II iterative 56 ms 35.4 MB Easy O(N) O(1)
1122 Relative Sort Array Ittrative 52 ms 34.9 MB Easy
67 Add Binary addBinary.js 72 ms 35.7 MB Easy 🔗
344 Reverse String Recursive 112 ms 48.6 MB Easy 0(N) 0(1)
509 Fibonacci Number Solution 76 ms 34.3 MB Easy
70 Climbing Stairs Recursive 52 ms 33.9 MB Easy 0(N) O(N) 🔗
728 Self Dividing Numbers Solution 68 ms 38 MB Easy
941 Valid Mountain Array Ittrative 56 ms 36.8 MB Easy 0(N) O(1) 🔗
905 Sort Array By Parity Solution 84 ms 37.3 MB Easy
819 Most Common Word most_common_word.js 76 ms 37.8 MB Easy
104 Maximum Depth of Binary Tree Recursion 72 ms 36.9 MB Easy O(N) 0(1) 🔗
657 Robot Return to Origin Solution 80 ms 41.3 MB Easy
206 Reverse Linked List Iterative
Recursive
64 ms
64 ms
35 MB
35.4 MB
Easy
412 Fizz Buzz Solution 72 ms 37.4 MB Easy
1002 Find Common Characters Solution 108 ms 38.1 MB Easy
876 Middle of the Linked List Solution 1
Solution 2
48 ms
44ms
33.9 MB
33.8 MB
Easy
126 Single Number Solution 60 ms 37.1 MB Easy
485 Max Consecutive Ones Solution 1
Solution 2
56 ms 37.1 MB Easy
258 Add Digits Solution 76 ms 36.3 MB Easy
237 Delete Node in a Linked List Solution 60 ms 35.6 MB Easy
242 Valid Anagram Solution 56 ms 37.8 MB Easy
448 Find All Numbers Disappeared in an Array Solution 6576 ms 45.7 MB Easy
217 Contains Duplicate Solution 96 ms 42.7 MB Easy
219 Contains Duplicate II Solution 72 ms 42.4 MB Easy
349 Intersection of Two Arrays Solution 1
Solution 2
56 ms 35.8 MB Easy
350 Intersection of Two Arrays II Solution
Solution 2
84 ms 38.3 MB Easy
977 Squares of a Sorted Array Solution 152 ms 43.5 MB Easy
599 Minimum Index Sum of Two Lists Solution 108 ms 43 MB Easy
26 Remove Duplicates from Sorted Array Solution 76 ms 37.2 MB Easy
100 Same Tree Solution 52 ms 33.9 MB Easy
704 Binary Search Iterative
Recursion
Easy
700 Search in a Binary Search Tree Solution 100ms 41.7 Easy
821 Shortest Distance to a Character Solution 192 ms 45.5 MB Easy
561 Array Partition I Solution 116 ms 39.1MB Easy
476 Number Complement Solution 52ms 33.9 MB Easy
617 Merge Two Binary Trees Solution 92 ms 40.4 MB Easy
268 Missing Number Solution 388 ms 37.1 MB Easy
1047 Remove All Adjacent Duplicates In String Solution 480 ms 39.7 MB Easy
125 Valid Palindrome Solution 76 ms 41 MB Easy
896 Monotonic Array Solution 68 ms 40.5 MB Easy
653 Two Sum IV - Input is a BST Solution 84 ms 41.5 MB Easy
589 N-ary Tree Preorder Traversal Solution 608 ms 77.1 MB Easy
965 Univalued Binary Tree univalued_binary_tree.js 52 ms 34 MB Easy
35 Search Insert Position search_insert_position.js 52 ms 34.5 MB Easy
922 Sort Array By Parity II sort_array_by_parity_II.js 100 ms 41.9 MB Easy
563 Binary Tree Tilt binary_tree_tilt.js 68 ms 37.7 MB Easy
686 Repeated String Match repeated_string_match.js 64 ms 35.9 MB Easy
429 N-ary Tree Level Order Traversal n-ary_tree_level_order_traversal.js 644 ms 80.9 MB Easy
590 N-ary Tree Postorder Traversal Solution 616 ms 80.9 MB Easy
1089 Duplicate Zeros duplicate_zeros.js 64 ms 35.7 MB Easy
783 Minimum Distance Between BST Nodes minimum_distance_between_bst_nodes.js 88 ms 34.7 MB Easy
189 Rotate Array rotate_array.js 92 ms 35.3 MB Easy
1013 Partition Array Into Three Parts With Equal Sum partition_array_into_three_parts.js 72 ms 39.6 MB Easy
387 First Unique Character in a String first_unique_character_in_a_string.js 124 ms 39.3 MB Easy
415 Add Strings add_string.js 60 ms 36.5 MB Easy 0(N) O(1)
167 Two Sum II - Input array is sorted two_sum_II.js 64 ms 35.5 MB Easy
20 Valid Parentheses valid_parentheses.js 52 ms 33.9 MB Easy 0(N) O(1)
121 Best Time to Buy and Sell Stock best_time_to_buy_and_sell_stock.js 56 ms 36.5 MB Easy 0(N) O(1)
680 Valid Palindrome II valid_palindrome_II.js 72 ms 43.2 MB Easy O(N) O(1)
414 Third Maximum Number third_maximum_number.js 76 ms 38 MB Easy
701 Insert into a Binary Search Tree Solution 112 ms 41.9 MB Medium
94 Binary Tree Inorder Traversal Solution 56 ms 33.7 MB Medium
1015 Smallest Integer Divisible by K Solution 52 ms 34.3 MB Medium
215 Kth Largest Element in an Array Solution 68 ms 35.9 MB Medium
74 Search a 2D Matrix Solution 48 ms 34.5 MB Medium
540 Single Element in a Sorted Array single_element_in_a_sorted_array.js 60 ms 35.2 MB Medium
2 Add Two Numbers add_two_numbers.js Medium
347 Top K Frequent Elements top_k_frequent_elements.js 80 ms 39.1 MB Medium
39 Combination Sum combination_sum.js 72 ms 35.8 MB Medium
40 Combination Sum II combination_sum_II.js 84 ms 37.6 MB Medium
46 Permutations permutations.js 88 ms 37.6 MB Medium
80 Remove Duplicates from Sorted Array II remove_duplicates_from_sorted_array_II.js 64 ms 35.8 MB Medium
78 Subsets subset.js 60 ms 35 MB Medium
151 Reverse Words in a String reverse_words_in_string.js 56 ms 34.6 MB Medium
647 Palindromic Substrings palindromic_substrings.js 704 ms 37.2 MB Medium
102. Binary Tree Level Order Traversal binary_tree_level_order_traversal.js 60 ms 34.9 MB Medium O(N)
912 Sort an Array Solution 7176 ms 38.9 MB Medium
287 Find the Duplicate Number find_the_duplicate_number.js 84 ms 36 MB Medium O(N) O(1)
64 Minimum Path Sum minimum_path_sum.js 52 ms 35.5 MB Medium o(N2) O(1) 🔗
49 Group Anagrams group_anagrams.js 152 ms 47.3 MB Medium NlogN 🔗
3 Longest Substring Without Repeating Characters Sliding Window Approach 84 ms 38.4 MB Medium O(N) 🔗
238 Product of Array Except Self product_of_array_except_self.js 76 ms 42.3 MB Medium O(N) O(1) 🔗
137 Single Number II Iterative 64 ms 37.6 MB Medium NlogN 🔗
11 Container With Most Water Ratcheting 52 ms 35.4 MB Medium O(N) O(1) 🔗
24 Swap Nodes in Pairs Recursive 68 ms 34 MB Medium O(N) 🔗
48 Rotate Image Iterative 56 ms 33.7 MB Medium O(N) O(1) 🔗
36 Valid Sudoku Itterative 68 ms 37.7 MB Medium O(1) O(1) 🔗
146 LRU Cache Map 216 ms 58.8 MB Medium O(1) O(1)
152 Maximum Product Subarray Dynamic Programming 60 ms 35 MB Medium O(N) O(1) 🔗
54 Spiral Matrix spiral_matrix.js 56 ms 34 MB Medium 🔗
394 Decode String Decode String 68 ms 33.7 MB Medium
340 Longest Substring with At Most K Distinct Characters Sliding Window Approach 68 ms 37.1 MB Hard NlogN 🔗
297 Serialize and Deserialize Binary Tree DFS Recursion 80 ms 43.6 MB Hard 🔗
76 Minimum Window Substring Sliding Window Hard

Others

Title Solution Links
1 Tree tree.js
2 Factorial factorial.js
3 Graph graph.js 🔗
4 Priority Queue

Approach

Name Explanation
Sliding Window https://www.youtube.com/watch?v=MK-NZ4hN7rs
https://www.youtube.com/watch?v=UEEvolnPA_k&t=962s