- 博客(17)
- 资源 (19)
- 收藏
- 关注
原创 网易编程题 塔
小易有一些立方体,每个立方体的边长为1,他用这些立方体搭了一些塔。现在小易定义:这些塔的不稳定值为它们之中最高的塔与最低的塔的高度差。小易想让这些塔尽量稳定,所以他进行了如下操作:每次从某座塔上取下一块立方体,并把它放到另一座塔上。注意,小易不会把立方体放到它原本的那座塔上,因为他认为这样毫无意义。现在小易想要知道,他进行了不超过k次操作之后,不稳定值最小是多少。输入描述:第一行两个数...
2019-07-31 21:34:35 186
原创 17. Letter Combinations of a Phone Number
class Solution { public List<String> letterCombinations(String digits) { if(digits.length() == 0){ return new ArrayList<>(); } String[][] digits_arr...
2019-07-26 22:13:52 88
原创 1026. Maximum Difference Between Node and Ancestor
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { pub...
2019-07-25 21:42:06 117
原创 5130. Number of Equivalent Domino Pairs
class Solution { public int numEquivDominoPairs(int[][] dominoes) { List<int[]> dom_list = new ArrayList<>(); for(int i = 0; i < dominoes.length; ++i){ d...
2019-07-21 11:58:32 157
原创 5133. Maximum of Absolute Value Expression
class Solution { public int maxAbsValExpr(int[] arr1, int[] arr2) { int sum = Integer.MIN_VALUE; for(int i = 0; i < arr1.length + 1; ++i){ for(int j = i + 1; j < ...
2019-07-21 11:57:48 224
原创 16. 3Sum Closest
class Solution { public int threeSumClosest(int[] nums, int target) { Arrays.sort(nums); int result = nums[0] + nums[1] + nums[2]; for(int i = 0; i < nums.length - 2; +...
2019-07-19 20:53:27 75
原创 105. Construct Binary Tree from Preorder and Inorder Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { publ...
2019-07-18 20:59:25 61
原创 889. Construct Binary Tree from Preorder and Postorder Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { pub...
2019-07-17 21:18:30 122
原创 106. Construct Binary Tree from Inorder and Postorder Traversal
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { publ...
2019-07-17 21:17:24 72
原创 vscode上指定python解释器
事先已经安装好了vscode和anaconda,并在anaconda中已经安装了python环境1、安装Python extension如果没有安装Python extension,每次打开.py的文件的时候vscode会提示安装这个玩意。注意,这个玩意不是python解释器。安装之后这个还会提示安装pylint,接着安装(会让你选择用pip安装还是conda安装,我直接用conda安装的)...
2019-07-15 10:55:34 14248
原创 1110. Delete Nodes And Return Forest
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { publ...
2019-07-07 14:57:04 215
原创 1109. Corporate Flight Bookings
class Solution { public int[] corpFlightBookings(int[][] bookings, int n) { int[] res_array = new int[n]; for(int[] mem : bookings){ for(int j = mem[0]; j <= mem[1];...
2019-07-07 14:56:26 230
原创 1095. Find in Mountain Array
/** * // This is MountainArray's API interface. * // You should not implement it, or speculate about its implementation * interface MountainArray { * public int get(int index) {} * public...
2019-07-07 14:55:33 198
原创 1093. Statistics from a Large Sample
class Solution { public double[] sampleStats(int[] count) { double min = -1; double max = -1; double mean = 0; double median = 0; double mode = 0; ...
2019-07-07 14:53:56 199
原创 15. 3Sum
class Solution { public List<List<Integer>> threeSum(int[] nums) { Arrays.sort(nums); List<List<Integer>> res_list = new ArrayList<>(); for(in...
2019-07-04 21:35:20 67
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人