摘要:
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total numb... 阅读全文
摘要:
Given two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You have the fol... 阅读全文
摘要:
Sort a linked list using insertion sort.注意:1.当新链表要插入最小值时,即插入一个新的头结点,那么原来的指向头结点的指针要更换。sortedList=s;使得sortedList指针也指向s所指的节点。(s为新头结点)2.注意q和preq的关系,插入最大结点... 阅读全文
摘要:
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
摘要:
Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
摘要:
Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文