Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:
Can you solve it without using extra space?解题思路设链表长度为n,头结点与循环节点之间的长度为k。定义两个指针slow和fast,slow每次走...
分类:
其他好文 时间:
2015-03-18 14:07:38
阅读次数:
116
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?runner 问题,注意while循环的条件。 1 /** 2 * Definit....
分类:
其他好文 时间:
2015-03-18 06:27:32
阅读次数:
114
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
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?思路:...
分类:
其他好文 时间:
2015-03-16 12:38:20
阅读次数:
95
题目链接:Unique Paths II
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and 0 resp...
分类:
其他好文 时间:
2015-03-15 23:43:50
阅读次数:
310
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:1.两个指针,一个走1步,一个走2步,如果相遇则有环注意: 在使用p->nex...
分类:
其他好文 时间:
2015-03-15 19:38:56
阅读次数:
126
标题:Populating Next Right Pointers in Each Node II通过率:31.7%难度:难Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tr...
分类:
其他好文 时间:
2015-03-13 14:00:13
阅读次数:
153
Unique Paths II问题:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle...
分类:
其他好文 时间:
2015-03-12 18:47:56
阅读次数:
181
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/44216867
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?
思路:
(1)题意为给定一个n*...
分类:
其他好文 时间:
2015-03-12 09:54:15
阅读次数:
105
Linked List Cycle ii Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it ...
分类:
其他好文 时间:
2015-03-12 00:39:43
阅读次数:
157