摘要:
回溯,全局变量 import java.util.ArrayList; import java.util.List; /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode le 阅读全文
摘要:
import java.util.*; /* 层次遍历的变形 */ class Solution { public List<List<Integer>> zigzagLevelOrder(TreeNode root) { List<List<Integer>> res = new ArrayLis 阅读全文
摘要:
思路:找序列中最小的那个数字,然后递增检查。 import java.util.HashSet; import java.util.Set; class Solution { public int longestConsecutive(int[] nums) { Set<Integer> set = 阅读全文
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } * 阅读全文