摘要: Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm sh... 阅读全文
posted @ 2014-11-26 23:14 LiBlog 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Solution:The same as N-Quee... 阅读全文
posted @ 2014-11-26 22:56 LiBlog 阅读(135) 评论(0) 推荐(0) 编辑
摘要: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all d... 阅读全文
posted @ 2014-11-26 22:55 LiBlog 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Solution: 1 public class Solution { 2 pu... 阅读全文
posted @ 2014-11-26 12:00 LiBlog 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from th... 阅读全文
posted @ 2014-11-26 11:31 LiBlog 阅读(126) 评论(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 concatena... 阅读全文
posted @ 2014-11-26 09:23 LiBlog 阅读(171) 评论(0) 推荐(0) 编辑