摘要:
class MinStack { Stack<Integer> A,B; /** initialize your data structure here. */ public MinStack() { A = new Stack<>(); B = new Stack<>(); } public vo 阅读全文
摘要:
class Solution { public int[] spiralOrder(int[][] matrix) { //判空 if(matrix.length == 0){ return new int[0]; } //定义矩阵 上下左右的边界 int left = 0; int right = 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ 阅读全文
摘要:
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ 阅读全文
摘要:
/** public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; } } */ public class S 阅读全文
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { 阅读全文
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { 阅读全文
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ //双指针法,2个指针遍历链表,其 阅读全文
摘要:
//双指针法,left在前找偶数,right在后找奇数,交换。继续找,当俩个指针碰面,跳出 class Solution { public int[] exchange(int[] nums) { int left = 0, right = nums.length - 1; while(left < 阅读全文
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { 阅读全文