Set Matrix Zeroes
Given a m x n matrix, 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 straight for...
分类:
其他好文 时间:
2015-07-29 17:16:51
阅读次数:
112
Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place.For example,
1
/ 2 5
/ \ 3 4 6
这个道题方法有多种,虽然下面这个很简单,但我觉得还是蛮经典。...
分类:
其他好文 时间:
2015-07-29 17:12:23
阅读次数:
141
题目描述:
Median?Value
The?Median?is?the?"middle"?of?a?sorted?list?of?numbers.
How?to?Find?the?Median?Value
To?find?the?Median,?place?the?numbers?in?value?order?and?f...
分类:
其他好文 时间:
2015-07-29 16:02:42
阅读次数:
180
Robert is a famous engineer. One day he was given a task by his boss. The background of the task was the following:
Given a map consisting of square blocks. There were three kinds of blocks: Wall,...
分类:
其他好文 时间:
2015-07-29 12:21:07
阅读次数:
147
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2015-07-28 18:27:00
阅读次数:
82
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m = 2 and n =
4,
return 1->4->3->2->5->NULL.
Note:
Given m, n satisfy t...
分类:
其他好文 时间:
2015-07-27 11:11:00
阅读次数:
113
问题描述Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.解决思路难点在于如何不使用辅助空间。一个巧妙的想法是,1. 使用两个标记变量,row0_has_zeros和col...
分类:
其他好文 时间:
2015-07-25 12:01:16
阅读次数:
139
【027-Remove Element(删除数组中的元素)】【LeetCode-面试算法经典-Java实现】【所有题目目录索引】原题 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 ch...
分类:
编程语言 时间:
2015-07-25 09:33:10
阅读次数:
165
Problem Definition: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 chan...
分类:
其他好文 时间:
2015-07-24 22:29:06
阅读次数:
148
问题描述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...
分类:
其他好文 时间:
2015-07-24 09:16:36
阅读次数:
117