IncredibleThings

导航

上一页 1 ··· 24 25 26 27 28

2015年3月11日 #

Reverse a Singly LinkedList

摘要: Reverse a Singly LinkedList * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) {... 阅读全文

posted @ 2015-03-11 04:45 IncredibleThings 阅读(129) 评论(0) 推荐(0) 编辑

2015年3月9日 #

LeetCode-Sort List

摘要: 这题的时间复杂度要求是O(n logn),很容易想到用mergeSort来解。 其中值得注意的是, 1.在merge function里dummy前置节点和tail的作用, 2.以及findMin里ListNode fast = head.next的作用, 3.sortList中mid.next = 阅读全文

posted @ 2015-03-09 23:13 IncredibleThings 阅读(90) 评论(0) 推荐(0) 编辑

LeetCode-Insertion Sort List

摘要: Sort a linked list using insertion sort. 这道题考察了linkedList的知识点,以及insertion sort的基本概念。考察了网上的做法,是建一个dummy node做前置节点, 每次取unsorted list里面的一个节点,记录下下一跳位置,然后把... 阅读全文

posted @ 2015-03-09 02:43 IncredibleThings 阅读(82) 评论(0) 推荐(0) 编辑

2015年3月8日 #

LeetCode-Find Minimum in Rotated Sorted Array

摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文

posted @ 2015-03-08 12:11 IncredibleThings 阅读(97) 评论(0) 推荐(0) 编辑

2015年3月7日 #

LeetCode-Find Peak Element

摘要: A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index... 阅读全文

posted @ 2015-03-07 00:09 IncredibleThings 阅读(117) 评论(0) 推荐(0) 编辑

2015年3月6日 #

LeetCode-Fraction to Recurring Decimal

摘要: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating,... 阅读全文

posted @ 2015-03-06 10:18 IncredibleThings 阅读(200) 评论(0) 推荐(0) 编辑

上一页 1 ··· 24 25 26 27 28