2.6 Given a circular linked list, implement an algorithm which returns the node at the beginning of the loop.DEFINITIONCircular linked list: A (corrup...
分类:
其他好文 时间:
2015-07-21 22:00:57
阅读次数:
118
2..5 You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the...
分类:
其他好文 时间:
2015-07-20 21:17:55
阅读次数:
192
2.2 Implement an algorithm to find the kth to last element of a singly linked list.这道题让我们求链表中倒数第k个元素,LeetCode中相类似的题目有Kth Largest Element in an Array 数...
分类:
其他好文 时间:
2015-07-19 13:21:05
阅读次数:
104
2.3 Implement an algorithm to delete a node in the middle of a singly linked list, given only access to that node.EXAMPLEInput: the node c from the li...
分类:
其他好文 时间:
2015-07-19 13:20:37
阅读次数:
86
2.1 Write code to remove duplicates from an unsorted linked list.FOLLOW UPHow would you solve this problem if a temporary buffer is not allowed?这道题让我们...
分类:
其他好文 时间:
2015-07-18 12:12:39
阅读次数:
181
1.8 Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 i...
分类:
其他好文 时间:
2015-07-17 07:08:39
阅读次数:
104
1.6 Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you d...
分类:
其他好文 时间:
2015-07-17 07:07:39
阅读次数:
126
1.5 Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a...
分类:
其他好文 时间:
2015-07-17 07:07:29
阅读次数:
134
1.7 Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column are set to 0.LeetCode中的原题,请参见我之前的博客Set Matrix Zeroes 矩...
分类:
其他好文 时间:
2015-07-17 07:07:00
阅读次数:
110
1.4 Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the end of the string to hold ...
分类:
其他好文 时间:
2015-07-16 13:32:22
阅读次数:
133