码迷,mamicode.com
首页 >  
搜索关键字:in place    ( 1961个结果
Leetcode:Set Matrix Zeroes
戳我去解题Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.这题还是很简单的,就是有点坑,遍历矩阵的时候,每遇到0的时候,我们不能立即将所在行和列置0,否则,到最后矩阵所有...
分类:其他好文   时间:2014-05-09 08:51:57    阅读次数:253
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
排序-归并排序
该算法基于一个简单的操作: 将两个有序的队列合成一个更大的有序队列。归并排序保证NlogN。原地归并的抽象算法(Abstract in-place merge):using System;namespace MergeSort{ class Program { static...
分类:其他好文   时间:2014-05-06 14:34:28    阅读次数:325
Reverse Linked List II
Link:http://oj.leetcode.com/problems/reverse-linked-list-ii/Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1...
分类:其他好文   时间:2014-05-05 22:46:11    阅读次数:411
【LeetCode】Remove Element
题目: Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn't matter what you leave beyond the new len...
分类:其他好文   时间:2014-05-05 12:58:57    阅读次数:294
FZOJ 1640 place blocks
OJ题目 : click here ~~ 题目分析:...
分类:其他好文   时间:2014-05-03 21:25:31    阅读次数:205
Reverse Linked List II
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:其他好文   时间:2014-05-02 09:10:46    阅读次数:252
ZOJ 1654 - Place the Robots (二分图最大匹配)
题意:在一个m*n的地图上,有空地,草和墙,其中空地和草能穿透攻击光线,而墙不能。每个机器人能够上下左右攻击,问在地图上最多能放多少个不互相攻击的机器人。这个题和HDU 1045 - Fire Net 很像。很容易联想到对每个点编号然后互相攻击的点连边再求图的最大独立集,但是这个题数据量太多,超时。...
分类:其他好文   时间:2014-05-02 00:20:34    阅读次数:344
Leetcode:Rotate Image 旋转图片
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 刚开始没有思路,但是自己举了几个简单的栗子才看出规律:需要一圈儿一圈儿的变换位置。有两层for循环:外...
分类:其他好文   时间:2014-05-01 18:33:34    阅读次数:359
leetcode day5 -- Reorder List && Linked List Cycle II
1、 ?? 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...
分类:其他好文   时间:2014-04-29 13:16:21    阅读次数:250
1961条   上一页 1 ... 194 195 196 197 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!