VXTW
VXTW
全部文章
分类
归档
标签
去牛客网
登录
/
注册
VXTW的博客
全部文章
(共10篇)
题解 | #查找重复元素#
哈希秒了时间复杂度O(n)空间复杂度O(n) function duplicates(arr) { let hash = {} let res = [] for(let i of arr) hash[i]?hash[i]++:h...
2024-05-30
0
245
题解 | #滑动窗口的最大值#
import java.util.*; public class Solution { public ArrayList<Integer> maxInWindows (int[] num, int size) { int i = 0; int ...
2024-01-08
0
275
题解 | #二叉树中和为某一值的路径(三)#
public class Solution { int path; public int FindPath(TreeNode root, int sum) { if (root==null){ return path; } ...
2023-12-09
0
221
题解 | #树的子结构#
public class Solution { boolean[] res = new boolean[] {false}; public boolean HasSubtree(TreeNode root1, TreeNode root2) { if(root2==n...
2023-10-12
0
300
题解 | #二叉搜索树的第k个节点#
public class Solution { public int KthNode(TreeNode proot, int k) { if (proot == null) return -1; if (k>=1) { for ...
2023-10-03
0
326
题解 | #二叉树的深度#
import java.util.*; public class Solution { public int TreeDepth(TreeNode root) { if (root == null) return 0; return 1 + Math.max...
2023-10-02
0
252
题解 | #删除链表的节点#
import java.util.*; public class Solution { public ListNode deleteNode (ListNode head, int val) { if(head.val==val) return head.next; ...
2023-10-01
1
232
题解 | #复杂链表的复制#
import java.util.ArrayList; public class Solution { public RandomListNode Clone(RandomListNode pHead) { int ListLength = getNodeLength(p...
2023-09-28
0
308
题解 | #链表中倒数最后k个结点#
public class Solution { public ListNode FindKthToTail(ListNode pHead, int k) { if (pHead==null){ return null; } ...
2023-09-28
0
286
题解 | #链表中环的入口结点#
import java.util.ArrayList; public class Solution { public ListNode EntryNodeOfLoop(ListNode pHead) { ArrayList list = new ArrayList(); ...
2023-09-27
0
299