题目:
Given a string, find the length of the longest substring without repeating characters. For example,
the longest substring without repeating letters for "abcabcbb" is "abc", which the length is ...
分类:
编程语言 时间:
2015-01-17 18:10:44
阅读次数:
251
https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/Given a binary tree struct TreeLinkNode { TreeLinkNode *left; ...
分类:
其他好文 时间:
2015-01-15 23:23:20
阅读次数:
212
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. ...
分类:
其他好文 时间:
2015-01-14 18:00:03
阅读次数:
139
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use constant ...
分类:
其他好文 时间:
2015-01-14 17:55:09
阅读次数:
199
传递指向指针的引用假设我们想编写一个与前面交换两个整数的 swap 类似的函数,实现两个指针的交换。已知需用 * 定义指针,用 & 定义引用。现在,问题在于如何将这两个操作符结合起来以获得指向指针的引用。这里给出一个例子: // swap values of two pointers to int ...
分类:
编程语言 时间:
2015-01-11 21:35:56
阅读次数:
289
Populating Next Right Pointers in Each Node...
分类:
其他好文 时间:
2015-01-09 15:35:48
阅读次数:
146
Populating Next Right Pointers in Each Node II...
分类:
其他好文 时间:
2015-01-09 15:32:43
阅读次数:
198
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil...
分类:
编程语言 时间:
2015-01-08 07:06:05
阅读次数:
216
题目:
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
给出一个链表,和一个非负数k, 要求从链表尾节点开始...
分类:
编程语言 时间:
2015-01-07 18:55:05
阅读次数:
196
题目:
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
思路:使用快慢两个指针。开始时,两个指针同时指向head,之后slow每次前行一步,fast每次前行两步。如果链表有环,这两个指针一定会相遇,如果没有...
分类:
编程语言 时间:
2015-01-07 13:16:22
阅读次数:
172