- 博客(4)
- 资源 (1)
- 收藏
- 关注
原创 [LeetCode] Longest Palindromic Substring(java)
我的想法很常规,常规的动态规划的思想public class Solution { public String longestPalindrome(String s) { if(s.length() < 2 ) return s; int max = 0,len = s.length(); char[] sChar
2017-02-26 19:08:46 210
原创 [LeetCode]Submission Details
我的答案暴力解答案用的是O(n)贴个答案public class Solution { public int maxArea(int[] height) { int max = 0; for(int i = 0; i< height.length - 1;i++){ for(int j = i+1; j<height.le
2017-02-23 21:50:18 299
原创 [LeetCode] Submission Details(Java) 高票答案边界值对否?
同样是层次遍历的解法,但是我的空间负责度较高,明明有next指针可以利用next做层次遍历先贴我自己的代码public class Solution { public void connect(TreeLinkNode root) { List> tree = new ArrayList>(); if(root != null)
2017-02-23 20:42:57 216
原创 [LeetCode] Count Primes(Java)
计算素数的个数我的想法中规中矩,就是暴力解法,贴一个答案解法,hash思想public class Solution { public int countPrimes(int n) { boolean[] notPrime = new boolean[n]; int count = 0; for (int i = 2; i < n; i+
2017-02-22 20:35:26 211
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人