摘要: /* public class TreeLinkNode { int val; TreeLinkNode left = null; TreeLinkNode right = null; TreeLinkNode next = null; TreeLinkNode(int val) { this.va 阅读全文
posted @ 2020-10-22 15:37 dlooooo 阅读(71) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int reversePairs(int[] nums) { int left = 0; int right = nums.length-1; int cnt=0; int[] tmp = new int[nums.length]; Arrays.fi 阅读全文
posted @ 2020-10-17 16:40 dlooooo 阅读(118) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int findPeakElement(int[] nums) { if(nums.length==1||nums[0]>nums[1]){ return 0; } if(nums[nums.length-1]>nums[nums.length-2]) 阅读全文
posted @ 2020-10-17 15:44 dlooooo 阅读(66) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int maxProfit(int[] prices) { int len = prices.length; int res = 0; int i = 0; while(i < len - 1){ while(i < len - 1 && prices 阅读全文
posted @ 2020-10-17 15:23 dlooooo 阅读(67) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int twoCitySchedCost(int[][] costs) { int len = costs.length; int t = len/2; Arrays.sort(costs,(a,b)->{return a[0]-a[1]-(b[0]- 阅读全文
posted @ 2020-10-13 13:51 dlooooo 阅读(54) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int coinChange(int[] coins, int amount) { Arrays.sort(coins); int[] dp = new int[amount+1]; Arrays.fill(dp,amount+1); dp[0] = 阅读全文
posted @ 2020-10-10 10:11 dlooooo 阅读(78) 评论(0) 推荐(0) 编辑
摘要: class Solution { public ListNode reverse(ListNode a,ListNode b){ a.next = b.next; b.next = null; b.next = a; return b; } public ListNode swapPairs(Lis 阅读全文
posted @ 2020-10-09 10:07 dlooooo 阅读(103) 评论(0) 推荐(0) 编辑
摘要: class Solution { public TreeNode Build(int[]nums,int left,int right){ if(left>right){ return null; } int mid = (left+right)>>1; TreeNode t = new TreeN 阅读全文
posted @ 2020-10-09 09:55 dlooooo 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 运行时数据区域 程序计数器 每个线程都会有一个私有的程序计数器。这是一块较小的内存区域,是当前线程所执行的字节码的行号指示器。当线程执行一个Java方法时,该计数器记录的是当前执行的虚拟机字节码指令的地址;当线程执行的是本地方法时,这个计数器的值应该为空。因此,该内存区域是唯一一个没有规定任何OOM 阅读全文
posted @ 2020-10-08 17:56 dlooooo 阅读(119) 评论(0) 推荐(0) 编辑
摘要: class Solution { public void merge(int[] nums1, int m, int[] nums2, int n) { int[] res = new int[m+n+1]; int l1 = 0; int l2 = 0; int i=0; while((l1<m) 阅读全文
posted @ 2020-10-07 09:14 dlooooo 阅读(151) 评论(0) 推荐(0) 编辑