码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
[leetcode]Median of Two Sorted Arrays
Median of Two Sorted ArraysThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run...
分类:其他好文   时间:2014-08-08 17:33:46    阅读次数:232
amazon 面经2
http://www.geeksforgeeks.org/amazon-interview-set-108-campus/F2F-1:1) Given a sorted circular link list and a pointer to random node, now insert a new...
分类:其他好文   时间:2014-08-08 04:18:25    阅读次数:248
Search in Rotated Sorted Array
问题:找出某个元素的位置朴素的暴力方法class Solution {public: int search(int A[], int n, int target) { int i; for(i=0;i<n;i++) { if(A[...
分类:其他好文   时间:2014-08-06 21:45:42    阅读次数:196
Remove Duplicates from Sorted Array II
问题:消除数组中重复次数超过三次的多余的数分析:若ai-1==ai-2若ai也相等,则清楚aiclass Solution {public: int removeDuplicates(int A[], int n) { int i,j; for(i=2;i<n;i+...
分类:其他好文   时间:2014-08-06 21:41:52    阅读次数:199
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 7 might become 4 5 6 7 0 1 2). You are given a target value to search. If found in the array retur...
分类:其他好文   时间:2014-08-05 00:48:58    阅读次数:248
[LeetCode] Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates": What if duplicates are allowed at most twice?For example, Given sorted array A = [1,1,1,2,2,3],Your function should...
分类:其他好文   时间:2014-08-05 00:24:38    阅读次数:281
[LeetCode] Convert Sorted List to Binary Search Tree(分治)
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.方法:为了使BST高度平衡,要找链表中的中值作为当前根节点。/** * Defin...
分类:其他好文   时间:2014-08-04 20:37:47    阅读次数:194
Remove Duplicates from Sorted Array II leetcode java
题目:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function shou....
分类:编程语言   时间:2014-08-04 13:24:27    阅读次数:256
Remove Duplicates from Sorted Array
问题:将有序的数组中重复的数字去掉分析:由于有序所以只用和前一个比较就行class Solution {public: int removeDuplicates(int A[], int n) { int i,j; if(n==0 || n==1) return n...
分类:其他好文   时间:2014-08-03 17:42:35    阅读次数:204
LeetCode "Remove Duplicates from Sorted List II"
Corner cases!class Solution {public: ListNode *deleteDuplicates(ListNode *head) { if (!head) return head; if (!head->next) return hea...
分类:其他好文   时间:2014-08-03 07:51:34    阅读次数:237
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!