摘要: GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]... 阅读全文
posted @ 2015-04-13 13:32 amazingzoe 阅读(151) 评论(0) 推荐(0)
摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re... 阅读全文
posted @ 2015-04-12 17:05 amazingzoe 阅读(124) 评论(0) 推荐(0)
摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana... 阅读全文
posted @ 2015-04-12 16:41 amazingzoe 阅读(169) 评论(0) 推荐(0)
摘要: Write a function to find the longest common prefix string amongst an array of strings.Analyse: 找一些序列的最长前缀子序列。 1 class Solution { 2 public: 3 strin... 阅读全文
posted @ 2015-04-12 15:45 amazingzoe 阅读(132) 评论(0) 推荐(0)
摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.AC最快的一次。。每种字母代表一个数字。小的在左边表示右减左,小的在右边表示右加左。如I... 阅读全文
posted @ 2015-04-12 15:09 amazingzoe 阅读(94) 评论(0) 推荐(0)
摘要: Determine whether an integer is a palindrome. Do this without extra space.Analyse:判断一个整数是否是回文数。注意负数都不是回文数。 1 class Solution { 2 public: 3 bool isP... 阅读全文
posted @ 2015-04-12 14:00 amazingzoe 阅读(134) 评论(0) 推荐(0)
摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes... 阅读全文
posted @ 2015-04-12 13:02 amazingzoe 阅读(92) 评论(0) 推荐(0)
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321此题注意边界条件 -2^31 v;12 while(x){13 v.push_bac... 阅读全文
posted @ 2015-04-12 11:20 amazingzoe 阅读(203) 评论(0) 推荐(0)
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2015-04-10 21:57 amazingzoe 阅读(201) 评论(0) 推荐(0)
摘要: Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 ->... 阅读全文
posted @ 2015-04-10 21:00 amazingzoe 阅读(144) 评论(0) 推荐(0)