自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 待学

1.Hashset2.Hashmap3.java常用方法如 Arrays.sort();

2018-12-10 21:21:00 183

原创 #121(122). 买卖股票的最佳时机(Ⅰ,Ⅱ)

第一版class Solution { public int maxProfit(int[] prices) { if(prices.length<2) return 0; int max_num=0; int min_num=Integer.MAX_VALUE; int max = 0; int in...

2019-02-01 18:40:04 126

原创 #21. 合并两个有序链表

https://leetcode-cn.com/problems/merge-two-sorted-lists/class Solution { public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1==null) return l2; if(l2==null) return l1;...

2019-01-15 14:34:51 124

原创 #78. 子集

https://leetcode-cn.com/problems/subsets/class Solution { public List<List<Integer>> subsets(int[] nums) { List<List<Integer>> subsets = new ArrayList&a

2019-01-13 18:11:42 90

原创 #236.二叉树的最近公共祖先

https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/description/初始代码class Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { St...

2018-12-07 18:43:17 120

原创 #235. 二叉搜索树的最近公共祖先

https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/初步代码(没有考虑到二叉搜索树左小右大的性质)(10ms72%)class Solution { public TreeNode lowestCommonAncestor(TreeNode root, T...

2018-12-05 11:10:43 128

原创 #9. 回文数

https://leetcode-cn.com/problems/palindrome-number/description/原始代码(普通写法)class Solution { public boolean isPalindrome(int x) { if(x<0) return false; String s= "&

2018-12-03 13:27:11 81

原创 #155. 最小栈

https://leetcode-cn.com/problems/min-stack/description/原始代码class MinStack { ArrayList<Integer> stack; int pointer; int min; /** initialize your data structure here. */ pub...

2018-12-01 20:28:42 105

原创 #169. 求众数

https://leetcode-cn.com/problems/majority-element/description/(学到了带标签的continue和break)class Solution { public int majorityElement(int[] nums) { int[] num = new int[nums.length]; i...

2018-11-29 22:12:55 124

原创 #100. 相同的树

https://leetcode-cn.com/problems/same-tree/description/①迭代class Solution { public boolean isSameTree(TreeNode p, TreeNode q) { if(p==null||q==null) { if(p==null&&...

2018-11-27 23:33:07 103

原创 #637. 二叉树的层平均值

https://leetcode-cn.com/problems/average-of-levels-in-binary-tree/description/①迭代版本class Solution { public List<Double> averageOfLevels(TreeNode root) { List<Double> re=new A...

2018-11-21 19:32:38 147

原创 LeetCode 682

#682. 棒球比赛https://leetcode-cn.com/problems/baseball-game/description/用IDEA和用网站编译答案不一样???(IDEA正确答案)class Solution { public int calPoints(String[] ops) { int last = 0; int sum = 0...

2018-11-18 21:25:40 164

原创 leetcode 349

#349. 两个数组的交集https://leetcode-cn.com/problems/intersection-of-two-arrays/description/class Solution { public int[] intersection(int[] nums1, int[] nums2) { int count=0; int flag ...

2018-11-14 18:35:45 154

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除