码迷,mamicode.com
首页 >  
搜索关键字:in-place    ( 1961个结果
LeetCode-Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For e...
分类:其他好文   时间:2015-03-18 06:26:57    阅读次数:109
[LeetCode]Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes’ values. For example, Given {1,2,3,4},...
分类:其他好文   时间:2015-03-17 23:51:32    阅读次数:344
【leetcode】Set Matrix Zeroes(middle)
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.思路:不能用额外空间,就用矩阵的第一行和第一列来标记这一行或这一列是否需要置0. 用两个bool量记录第一行和第一列是否需...
分类:其他好文   时间:2015-03-17 17:37:25    阅读次数:149
[LeetCode]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 another array, you must do this in place wit...
分类:其他好文   时间:2015-03-17 15:49:28    阅读次数:128
【leetcode】Reorder List (middle)
Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam...
分类:其他好文   时间:2015-03-16 22:44:06    阅读次数:139
【LeetCode从零单排】No 114 Flatten Binary Tree to Linked List
题目Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / 2 5 / \ 3 4 6 The flattened tree should look like: 1 2 ...
分类:其他好文   时间:2015-03-16 16:33:35    阅读次数:121
[LeetCode] Set Matrix Zeroes 矩阵赋零
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s...
分类:其他好文   时间:2015-03-16 14:26:38    阅读次数:105
(中等) HDU 3416 Marriage Match IV,SPFA+SAP。
Description Do not sincere non-interference。 Like that show, now starvae also take part in a show, but it take place between city A and B. Starv...
分类:其他好文   时间:2015-03-14 23:08:52    阅读次数:188
Reverse Linked List II
Reverse Linked List II问题:Reverse a linked list from positionmton. Do it in-place and in one-pass.思路: 三行情书,用的飞起我的代码:public class Solution { public ...
分类:其他好文   时间:2015-03-14 13:42:54    阅读次数:103
]Leetcode]-[Reorder List ]-三种解法
Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam...
分类:其他好文   时间:2015-03-13 23:31:34    阅读次数:164
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!