- 博客(7)
- 收藏
- 关注
原创 快速排序
@Test public void test5(){ int[] i = {25,4,5,7,18,21,23}; quickSort(i, 0 , i.length); System.out.println(Arrays.toString(i)); } private void quickSort(int[] array, int begin, int end){
2015-10-01 17:28:53 175
原创 二分查找的两种实现
二分查找比较简单,因为面试时可能遇到,所以自己写了实现,二分查找的前提是列表是有序的。 递归实现: private int intbinary_search_recursive(int[] array, int target){ int end = array.length - 1; int mid = end / 2; if (array[mid] ==
2015-10-01 11:15:50 193
原创 Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. public class
2015-06-19 14:05:47 314
原创 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)). 我的时间复杂度为O(n),其实仅为(m+n)/
2015-06-09 16:45:31 222
原创 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo
2015-06-05 14:11:00 246
原创 Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2015-06-04 15:38:19 276
原创 two sum @leetcode
经朋友推荐,第一次接触leetcode,感觉不错,决定从第一道题做起,现将我做的第一题 tuo sum记录下来,抛砖引玉,希望各位朋友能指出可以优化的地方! public class Solution { public int[] twoSum(int[] nums, int target) { if(nums == null || nums.length
2015-06-04 10:39:48 218
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人