上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页
摘要: class Solution { public List> threeSum(int[] nums) { List> ret=new ArrayList>(); Arrays.sort(nums); for(int i=0;i0) r--; else ... 阅读全文
posted @ 2017-09-22 12:32 Weiyu Wang 阅读(110) 评论(0) 推荐(0)
摘要: class Solution { public String intToRoman(int num) { String[][] r=new String[][]{{"","M","MM","MMM"}, {"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"}, ... 阅读全文
posted @ 2017-09-22 12:12 Weiyu Wang 阅读(122) 评论(0) 推荐(0)
摘要: class Solution { public int maxArea(int[] height) { int maxArea=0; int i=0; int j=height.length-1; while(i<j) { maxArea=Math.max(maxArea,Math.m... 阅读全文
posted @ 2017-09-22 11:23 Weiyu Wang 阅读(137) 评论(0) 推荐(0)
摘要: Recursive DP 阅读全文
posted @ 2017-09-22 04:31 Weiyu Wang 阅读(168) 评论(0) 推荐(0)
摘要: class Solution { public int myAtoi(String str) { str=str.trim(); if(str.length()==0) return 0; int flag=1; int i=0; if(str.charAt(i)=='+') ... 阅读全文
posted @ 2017-09-22 02:18 Weiyu Wang 阅读(131) 评论(0) 推荐(0)
摘要: class Solution { public String convert(String s, int numRows) { if(numRows==1) return s; int divisor=(numRows-1)*2; StringBuilder sb=new StringBuilder(); ... 阅读全文
posted @ 2017-09-22 01:53 Weiyu Wang 阅读(88) 评论(0) 推荐(0)
摘要: Brutal Force: O(n^2) Manacher: O(n) 阅读全文
posted @ 2017-09-21 15:07 Weiyu Wang 阅读(146) 评论(0) 推荐(0)
摘要: public class Solution { public double findMedianSortedArrays(int[] nums1, int[] nums2) { int l=(nums1.length+nums2.length+1)>>1; int r=(nums1.length+nums2.length+2)>>1; re... 阅读全文
posted @ 2017-09-21 12:34 Weiyu Wang 阅读(152) 评论(0) 推荐(0)
摘要: class Solution { public int lengthOfLongestSubstring(String s) { Map map=new HashMap(); int maxlen=0; for(int j=0,i=0;i<s.length();i++) { char c=s.char... 阅读全文
posted @ 2017-09-21 05:52 Weiyu Wang 阅读(110) 评论(0) 推荐(0)
摘要: class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode ret=new ListNode(0); ListNode l3=ret; int carry=0; while(l1!=null||l2!=null||ca... 阅读全文
posted @ 2017-09-21 05:39 Weiyu Wang 阅读(114) 评论(0) 推荐(0)
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 22 下一页