码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
Leetcode Search 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 7might become4 5 6 7 0 1 2).You are given a target value t...
分类:其他好文   时间:2015-02-02 15:36:38    阅读次数:182
Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 解题思路:与之前刷过的一题有所不同,这里要求保...
分类:其他好文   时间:2015-02-02 14:15:43    阅读次数:176
LeetCode --- 26. Remove Duplicates from Sorted Array
题目链接:Remove Duplicates from Sorted Array Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for ano...
分类:其他好文   时间:2015-02-02 12:34:17    阅读次数:151
Leetcode#26 Remove Duplicates from Sorted Array
原题地址基本模拟题代码: 1 int removeDuplicates(int A[], int n) { 2 if (n <= 0) 3 return 0; 4 5 int i = 1; 6 int ...
分类:其他好文   时间:2015-02-02 12:06:25    阅读次数:94
Find Minimum in Rotated Sorted Array
https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,...
分类:其他好文   时间:2015-02-02 00:37:13    阅读次数:264
Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Given 1->2->3->3->4->4->5, return 1->2->5. Given 1->...
分类:其他好文   时间:2015-02-01 16:10:35    阅读次数:187
Search in Rotated Sorted Array
本题的思路是二分查找,关键是怎么用二分查找。通过middle值和数组尾部的值比较,可以确定start-Middle和middle-end,这两部分那一部分是有序的,有序的数组是可以用二分查找的。class Solution {public: int search(int A[], int n,...
分类:其他好文   时间:2015-02-01 16:02:15    阅读次数:193
Merge Two Sorted Lists
https://oj.leetcode.com/problems/merge-two-sorted-lists/Merge two sorted linked lists and return it as a new list. The new list should be made by spli...
分类:其他好文   时间:2015-02-01 00:35:26    阅读次数:147
Convert Sorted Array to Binary Search Tree
https://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/Given an array where elements are sorted in ascending order, convert it to...
分类:其他好文   时间:2015-01-31 23:08:44    阅读次数:196
[LeetCode]153.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. You may assume no duplicate ...
分类:其他好文   时间:2015-01-31 17:54:53    阅读次数:203
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!