码迷,mamicode.com
首页 >  
搜索关键字:sorted    ( 5925个结果
Leetcode:Search a 2D Matrix
戳我去解题Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted f...
分类:其他好文   时间:2014-05-09 08:27:24    阅读次数:241
LeetCode -- Remove Duplicates from Sorted List
题目链接简单题,就是从单链表中删除重复元素。附上代码: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * L...
分类:其他好文   时间:2014-05-08 18:02:52    阅读次数:338
leetcode第一刷_Convert Sorted List to Binary Search Tree
好,二叉搜索树粉末登场,有关他的问题有这么几个,给你一个n,怎样求所有的n个节点的二叉搜索树个数?能不能把所有的这些二叉搜索树打印出来? 这道题倒不用考虑这么多,直接转就行了,我用的思想是分治,每次找到一半的位置,分离出中间节点,作为新子树的根节点,然后递归构造前半部分和后半部分。 class Solution { public: TreeNode *sortedListToBST(L...
分类:其他好文   时间:2014-05-08 11:07:14    阅读次数:266
Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:其他好文   时间:2014-05-08 07:29:02    阅读次数:285
Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * public class TreeN...
分类:其他好文   时间:2014-05-08 00:51:46    阅读次数:430
Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2014-05-07 14:07:56    阅读次数:345
Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-...
分类:其他好文   时间:2014-05-07 13:42:51    阅读次数:278
LeetCode合集
一 线性表 1.1  数组 1.1.1 Remove Duplicates from Sorted Array 1.1.2 Remove Duplicates from Sorted Array II 1.1.3 Search in Rotated Sorted Array 1.1.4 Search in Rotated Sorted Array II 1.1.5 Median of...
分类:其他好文   时间:2014-05-07 04:24:26    阅读次数:363
Merge Two Sorted Lists
Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir...
分类:其他好文   时间:2014-05-06 23:54:10    阅读次数:469
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-05-06 19:03:11    阅读次数:365
5925条   上一页 1 ... 589 590 591 592 593 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!