143. Reorder List
url: https://leetcode.com/problems/reorder-list/description/ Input: head = [1,2,3,4,5,6] Output: [1,6,2,5,3,4] 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> null =&...
url: https://leetcode.com/problems/reorder-list/description/ Input: head = [1,2,3,4,5,6] Output: [1,6,2,5,3,4] 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> null =&...
url: https://leetcode.com/problems/subarray-product-less-than-k/description/ Input: nums = [10, 5, 2, 6], k = 100 Output: 8 Explanation: [10] [5] [2] [6] [10, 5] = 50 [5, 2] = 10 ...
url: https://leetcode.com/problems/merge-intervals/description/ Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] over...
url: https://leetcode.com/problems/kth-smallest-element-in-a-bst/description/ Input: root = [5,3,6,2,4,null,null,1], k = 3 Output: 3 💻 Code Approach : In the binary tree, inorder counts...
url: https://leetcode.com/problems/count-subarrays-with-score-less-than-k/description/ Input: nums = [2,1,4,3,5], k = 10 Output: 6 Explanation: The 6 subarrays having scores less than 10 a...
url:https://leetcode.com/problems/lru-cache/description/ Example Input: [“LRUCache”, “put”, “put”, “get”, “put”, “get”, “put”, “get”, “get”, “get”] [[2], [1, 1], [2, 2], [1], [3, 3], [2], [...
url:https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/ Example Input: preorder = [3,9,20,15,7], inorder = [9,3,15,20,7] Output: [3,9,20,nu...
url:https://leetcode.com/problems/top-k-frequent-elements/description/ Example Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] 💻 Code Approach : Count each number using hash, then prioriti...
url: https://leetcode.com/problems/string-to-integer-atoi/description/ Example Input: s = “1337c0d3” Output: 1337 Explanation: Step 1: “1337c0d3” (no characters read because there is no le...
url: https://leetcode.com/problems/word-break/description/ Example Input: s = “leetcode”, wordDict = [“leet”,”code”] Output: true Explanation: Return true because “leetcode” can be segmented...