摘要:
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.You may not alter the values in the nodes, only nodes itself may be changed.Only constant memory is all 阅读全文
posted @ 2013-08-15 21:27
冰点猎手
阅读(212)
评论(0)
推荐(0)
摘要:
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr eat / \ / \g r e at / \ a tTo scramble the string, we may choose any non-lea... 阅读全文
posted @ 2013-08-15 20:24
冰点猎手
阅读(192)
评论(0)
推荐(0)
摘要:
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) Insert a characterb) Delete a characterc) Replace a character class Solution {public: int minDist... 阅读全文
posted @ 2013-08-15 19:04
冰点猎手
阅读(225)
评论(0)
推荐(0)
摘要:
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the two partitions.For example,Given 1->4->3->2->5->2 and x = 3,return 1->2->2-> 阅读全文
posted @ 2013-08-15 17:00
冰点猎手
阅读(140)
评论(0)
推荐(0)