https://github.com/hxu296/leetcode-company-wise-problems-2022/blob/main/companies/Google.csvgithub.com/hxu296/leetcode-company-wise-problems-2022/blob/main/companies/Google.csv 上次按顺序刷的,没注意看前面几个的出现频率都是1,今天先从高频的开始刷,至少大于3的吧。2103...
Find the Missing Number (easy) Find all Missing Numbers (easy) Find the Duplicate Number (easy) Find all Duplicate Numbers (easy) 6. Pattern: In-place Reversal of a LinkedList,原地链表翻转类型 在一大类问题中,题目可能需要你去翻转整条链表中某一段的节点。通常,要求都是你得原地翻转,就是重复使...
// Problem: LeetCode 234// URL: https://leetcode-cn.com/problems/palindrome-linked-list/// Tags: Linked List Two Pointers Recursion// Difficulty: Easy#include<iostream>#include<vector>using namespacestd;structListNode{intval; ListNode* next; };classSolution{public:boolisPalindrome(ListNode* head...
res += recursionPathSum(node.right, prefixSumCount, target, currSum); // 4.回到本层,恢复状态,去除当前节点的前缀和数量 prefixSumCount.put(currSum, prefixSumCount.get(currSum) - 1); return res; } } 作者:burning-summer 链接:https://leetcode-cn.com/problems/path-sum-iii/solution/qian-z...
public class No404 { public class TreeNode{ int val; TreeNode left; TreeNode right; TreeNode(int x){ val = x; } } public static void main(String[] args) { } // 递归遍历 public int sumOfLeftLeavesRecursion(TreeNode root){ // 特判 if (root == null){ return 0; } return dfs...
In principle, the board is infinite, which would cause problems when the active area encroaches the border of the array. How would you address these problems? 【解答】状态转换的问题,把代码逻辑想清楚再写。这类题算法本身不难,也没什么变态 case,关键是代码逻辑要规划清楚。 设置了四种状态:1:live,...
938 938. Range Sum of BST.java Easy [BST, Recursion, Tree] Java 500 210 210. Course Schedule II.java Medium [BFS, DFS, Graph, Topological Sort] O(n) O(n) Java 501 68 68. Text Justification.java Hard [Enumeration, String] O(n) go over words O(maxLength) buffer list Java 502 31...
Recursion Two Pointers 26 Remove Duplicates from Sorted Array 1 3 array Two Pointers 27 Remove Element 1 4 array Two Pointers 28 Implement strStr() 4 5 string Two Pointers KMP rolling hash 29 Divide Two Integers 4 3 Binary Search Math 30 Substring with Concatenation of All Words 3 1 string...
938 938. Range Sum of BST.java Easy [BST, Recursion, Tree] Java 500 210 210. Course Schedule II.java Medium [BFS, DFS, Graph, Topological Sort] O(n) O(n) Java 501 68 68. Text Justification.java Hard [Enumeration, String] O(n) go over words O(maxLength) buffer list Java 502 31...
-105<= Node.val <= 105 Follow up:Could you do that without using any extra space? (Assume that the implicit stack space incurred due to recursion does not count). Copyright ©️ 2025 LeetCode All rights reserved Case 1 Case 2 [1,null,2,2]...