摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas... 阅读全文
posted @ 2014-12-01 23:15 Jessica程序猿 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs... 阅读全文
posted @ 2014-12-01 22:34 Jessica程序猿 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ],... 阅读全文
posted @ 2014-12-01 20:25 Jessica程序猿 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 动态规划Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longes... 阅读全文
posted @ 2014-12-01 19:48 Jessica程序猿 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on... 阅读全文
posted @ 2014-12-01 16:25 Jessica程序猿 阅读(318) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm... 阅读全文
posted @ 2014-12-01 14:18 Jessica程序猿 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".思路:逐位相加,进位保留在和的下一位中。C++实现代码:#include#include#in... 阅读全文
posted @ 2014-12-01 11:20 Jessica程序猿 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Question:Given an integer, convert it to a r... 阅读全文
posted @ 2014-12-01 11:05 Jessica程序猿 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.首先简单介绍一下罗马数字,一下摘自维基百科罗马数字共有7个,即I(1)、V(5)、X(1... 阅读全文
posted @ 2014-12-01 10:35 Jessica程序猿 阅读(204) 评论(0) 推荐(0) 编辑