随笔分类 -  Leetcode+题

摘要:The n-queens puzzle is the problem of placing n queens on an n×nchessboard such that no two queens attack each other. Given an integer n, return all d 阅读全文
posted @ 2017-07-08 16:44 王大咩的图书馆 阅读(316) 评论(0) 推荐(0)
摘要:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. Follow up: Did you use extra sp 阅读全文
posted @ 2017-07-08 15:25 王大咩的图书馆 阅读(225) 评论(0) 推荐(0)
摘要:Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: For example, Give 阅读全文
posted @ 2017-07-08 13:23 王大咩的图书馆 阅读(417) 评论(0) 推荐(1)
摘要:A message containing letters fromA-Zis being encoded to numbers using the following mapping: Given an encoded message containing digits, determine the 阅读全文
posted @ 2017-07-07 22:20 王大咩的图书馆 阅读(306) 评论(0) 推荐(0)
摘要:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati 阅读全文
posted @ 2017-07-07 17:03 王大咩的图书馆 阅读(245) 评论(0) 推荐(0)
摘要:The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total num 阅读全文
posted @ 2017-07-07 09:30 王大咩的图书馆 阅读(333) 评论(0) 推荐(0)
摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 ="aabcc",s2 ="dbbca", When s3 ="aadbbcbcac", return 阅读全文
posted @ 2017-07-06 20:35 王大咩的图书馆 阅读(300) 评论(0) 推荐(0)
摘要:Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a subset must be in non-descending ord 阅读全文
posted @ 2017-07-06 15:57 王大咩的图书馆 阅读(1085) 评论(0) 推荐(0)
摘要:Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must no 阅读全文
posted @ 2017-07-06 15:17 王大咩的图书馆 阅读(3059) 评论(0) 推荐(0)
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have 阅读全文
posted @ 2017-07-06 10:24 王大咩的图书馆 阅读(245) 评论(0) 推荐(0)
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2017-07-06 08:57 王大咩的图书馆 阅读(489) 评论(0) 推荐(0)
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2017-07-05 16:50 王大咩的图书馆 阅读(274) 评论(0) 推荐(0)
摘要:Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space 阅读全文
posted @ 2017-07-05 15:46 王大咩的图书馆 阅读(235) 评论(0) 推荐(0)
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2017-07-05 15:12 王大咩的图书馆 阅读(272) 评论(0) 推荐(0)
摘要:Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such p 阅读全文
posted @ 2017-07-05 10:37 王大咩的图书馆 阅读(213) 评论(0) 推荐(0)
摘要:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For 阅读全文
posted @ 2017-07-04 18:27 王大咩的图书馆 阅读(219) 评论(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 t 阅读全文
posted @ 2017-07-04 17:50 王大咩的图书馆 阅读(199) 评论(0) 推荐(0)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2017-07-04 16:05 王大咩的图书馆 阅读(161) 评论(0) 推荐(0)
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning 阅读全文
posted @ 2017-07-04 10:18 王大咩的图书馆 阅读(404) 评论(0) 推荐(0)
摘要:There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re 阅读全文
posted @ 2017-07-03 21:11 王大咩的图书馆 阅读(269) 评论(0) 推荐(0)