
leetcode
wpxiaoxue
这个作者很懒,什么都没留下…
展开
-
Java实现Leetcood --Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).首先想到的是最笨的方法,将两个数组拼接在一起,然后排序,取中原创 2015-05-13 18:45:54 · 439 阅读 · 0 评论 -
渣渣的救赎-LeetCode
leetcode java 实现3 Longest Substring Without Repeating Characterspublic class Solution { public int lengthOfLongestSubstring(String s) { int i = 0, j = 0; int maxlength = 0;原创 2015-05-07 17:14:16 · 383 阅读 · 0 评论 -
Shortest Palindrome leetcode-java
先制作原字符串的对称镜像字符串,如s = “abcd”, 镜像a = “abcddcba”+” “。 然后对新字符串a,按KMP算法求next的方法,求next, public class Solution { public String shortestPalindrome(String s) { if(s.length() == 0||s.length() ==原创 2015-07-01 13:35:40 · 445 阅读 · 0 评论