摘要: There are a total ofncourses you have to take, labeled from0ton - 1.Some courses may have prerequisites, for example to take course 0 you have to firs... 阅读全文
posted @ 2015-05-21 12:59 匡子语 阅读(245) 评论(0) 推荐(0)
摘要: Reverse a singly linked list.思路:没啥好说的。秒...ListNode* reverseList(ListNode* head) { ListNode * rList = NULL, * tmp = NULL; while(head != N... 阅读全文
posted @ 2015-05-21 10:38 匡子语 阅读(166) 评论(0) 推荐(0)
摘要: Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文
posted @ 2015-05-21 10:26 匡子语 阅读(265) 评论(0) 推荐(0)
摘要: Count the number of prime numbers less than a non-negative number,n思路:数质数的个数开始写了个蛮力的,存储已有质数,判断新数字是否可以整除已有质数。然后妥妥的超时了(⊙v⊙)。看提示,发现有个Eratosthenes算法找质数的,说... 阅读全文
posted @ 2015-05-21 10:13 匡子语 阅读(224) 评论(0) 推荐(0)