摘要: Write a function to find the longest common prefix string amongst an array of strings.(每个字符串从0开始的公共部分即最长公共前缀)C++代码如下:#include#include#includeusing nam... 阅读全文
posted @ 2014-11-14 22:18 Jessica程序猿 阅读(243) 评论(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 @ 2014-11-14 21:46 Jessica程序猿 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
posted @ 2014-11-14 20:27 Jessica程序猿 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new lengt... 阅读全文
posted @ 2014-11-14 19:59 Jessica程序猿 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文
posted @ 2014-11-14 19:04 Jessica程序猿 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.这个题应该就是求子串的问题,改进的方法是kmp算法。... 阅读全文
posted @ 2014-11-14 17:22 Jessica程序猿 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文
posted @ 2014-11-14 16:04 Jessica程序猿 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.C++代码如下:#... 阅读全文
posted @ 2014-11-14 15:33 Jessica程序猿 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2014-11-14 10:53 Jessica程序猿 阅读(279) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2014-11-14 09:12 Jessica程序猿 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu... 阅读全文
posted @ 2014-11-14 09:09 Jessica程序猿 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal... 阅读全文
posted @ 2014-11-14 09:06 Jessica程序猿 阅读(187) 评论(0) 推荐(0) 编辑