随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 ··· 9 下一页
摘要:Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil... 阅读全文
posted @ 2014-12-02 16:33 Jessica程序猿 阅读(174) 评论(0) 推荐(0)
摘要:Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The... 阅读全文
posted @ 2014-12-02 14:11 Jessica程序猿 阅读(171) 评论(0) 推荐(0)
摘要:Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possibl... 阅读全文
posted @ 2014-12-02 11:20 Jessica程序猿 阅读(295) 评论(0) 推荐(0)
摘要:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati... 阅读全文
posted @ 2014-12-02 09:35 Jessica程序猿 阅读(247) 评论(0) 推荐(0)
摘要: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程序猿 阅读(283) 评论(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程序猿 阅读(248) 评论(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程序猿 阅读(202) 评论(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程序猿 阅读(210) 评论(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程序猿 阅读(325) 评论(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程序猿 阅读(206) 评论(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程序猿 阅读(218) 评论(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程序猿 阅读(180) 评论(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程序猿 阅读(210) 评论(0) 推荐(0)
摘要:Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2014-11-30 21:20 Jessica程序猿 阅读(282) 评论(0) 推荐(0)
摘要:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.#include#include#includeusi... 阅读全文
posted @ 2014-11-30 20:28 Jessica程序猿 阅读(167) 评论(0) 推荐(0)
摘要:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc... 阅读全文
posted @ 2014-11-30 19:37 Jessica程序猿 阅读(274) 评论(0) 推荐(0)
摘要:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ... 阅读全文
posted @ 2014-11-30 18:32 Jessica程序猿 阅读(179) 评论(0) 推荐(0)
摘要:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECODEBA... 阅读全文
posted @ 2014-11-30 09:45 Jessica程序猿 阅读(182) 评论(0) 推荐(0)
摘要:Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one letter can be ... 阅读全文
posted @ 2014-11-29 23:29 Jessica程序猿 阅读(376) 评论(0) 推荐(0)
摘要:Dynamic ProgrammingGivens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", r... 阅读全文
posted @ 2014-11-29 21:38 Jessica程序猿 阅读(214) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 9 下一页