摘要:
http://jingyan.baidu.com/article/27fa7326e4809646f8271fc7.html 阅读全文
摘要:
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... 阅读全文
摘要:
网上各种标为2013年,实际上都是2012年或者更早的,下面的才是真正的2013年5月5日考试的卷子。答题说明:1.答题时间90分钟,请注意把握时间;2.试题分为四个部分:单项选择题(10题,20分)、不定向选择题(4题,20分)、填空问答(5题,40分)、综合体(1题,20分);3.其他一些乱七八... 阅读全文
摘要:
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... 阅读全文
摘要:
/*题目描述:从字典dict中找某些子串来组合成s思路:用dp来记录以序号i为结尾的字符串能否在字典中匹配成功。当有字符s[i]匹配不成功,而该字符前面的dp[j]出现了true,那么可以看是否有分割字符,即该j+1到i的子串看是否可以在字典中匹配。例如s="abcd" dict=[a,b,abc,... 阅读全文
摘要:
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... 阅读全文
摘要:
c++随机数的产生,参考了某博客,自己也调试了,rand()和srand()之间的联系;可以认为rand()在每次被调用的时候,它会查看: 1) 如果用户在此之前调用过srand(seed),给seed指定了一个值,那么它会自动调用srand(seed)一次来初始化它的起始值。 2) 如果用户在... 阅读全文