摘要:
class Solution { public int[] spiralOrder(int[][] matrix) { int m = matrix.length; if(m == 0) return new int[]{}; int n = matrix[0].length; if(m == 1) 阅读全文
posted @ 2020-08-10 20:05
欣姐姐
阅读(101)
评论(0)
推荐(0)
摘要:
递归 public boolean isSymmetric(TreeNode root) { return root == null || isSymmetric(root.left,root.right); } private boolean isSymmetric(TreeNode left, 阅读全文
posted @ 2020-08-10 18:00
欣姐姐
阅读(90)
评论(0)
推荐(0)
摘要:
class Solution { public TreeNode mirrorTree(TreeNode root) { if(root == null) return null; TreeNode temp = root.left; root.left = root.right; root.rig 阅读全文
posted @ 2020-08-10 17:52
欣姐姐
阅读(82)
评论(0)
推荐(0)
摘要:
class Solution { public boolean isSubStructure(TreeNode A, TreeNode B) { if(A==null || B==null) return false; if(A.val != B.val){ return isSubStructur 阅读全文
posted @ 2020-08-10 17:44
欣姐姐
阅读(86)
评论(0)
推荐(0)
摘要:
class Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode dump = new ListNode(-1); ListNode p = dump; while(l1!=null && l2!= 阅读全文
posted @ 2020-08-10 17:00
欣姐姐
阅读(101)
评论(0)
推荐(0)
摘要:
class Solution { public ListNode getKthFromEnd(ListNode head, int k) { ListNode p = head; int count = 0; while(p!=null){ count++; p = p.next; } if(k>c 阅读全文
posted @ 2020-08-10 16:28
欣姐姐
阅读(119)
评论(0)
推荐(0)
摘要:
双指针 public int[] exchange(int[] nums) { int len = nums.length; int[] res = new int[len]; int j = 0, k = len-1; for (int num : nums) { if ((num & 0x1) 阅读全文
posted @ 2020-08-10 15:48
欣姐姐
阅读(104)
评论(0)
推荐(0)
摘要:
class Solution { int i = 0; public boolean isNumber(String s) { s = s.trim(); int n = s.length(); if(n == 0) return false; boolean b = scanInteger(s); 阅读全文
posted @ 2020-08-10 15:47
欣姐姐
阅读(109)
评论(0)
推荐(0)
摘要:
class Solution { public boolean isMatch(String s, String p) { int m = s.length(); int n = p.length(); int i = 0,j = 0; char[] s1 = s.toCharArray(); ch 阅读全文
posted @ 2020-08-10 15:21
欣姐姐
阅读(136)
评论(0)
推荐(0)
摘要:
没什么难度。 class Solution { public ListNode deleteNode(ListNode head, int val) { ListNode dump = new ListNode(-1); dump.next = head; ListNode pre = dump; 阅读全文
posted @ 2020-08-10 10:35
欣姐姐
阅读(73)
评论(0)
推荐(0)

浙公网安备 33010602011771号