摘要:
整型数组按照字典序排序 输入 ... 0,1,2,3,5,7,8,1001,10 9 ... 输出 ... 0,1,10,1001,2,3,5,7,8 Collections.sort(list, new Comparator<Integer>() { @Override public int co 阅读全文
摘要:
二维数组根据其下标,判断它是第几个元素 3 3 0 2 2 1 2 1 2 2 1 public class qqqq { static int row; static int col; public static void main(String[] args) { Scanner in = ne 阅读全文
摘要:
已知BST的前序遍历,还原BST arr数组:前序遍历 list:排序后的 arr 数组【BST的 中序遍历】 public static TreeNode getRoot(int[] arr, List<Integer> list){ int index = -1; for (int i = 0; 阅读全文
摘要:
给定二叉树的前序遍历,遍历是否是 BST public static boolean isValid(int[] arr, int start, int end, int min, int max){ if (start > end){ // start > end:当前子树为空,返回 true,因 阅读全文