随笔分类 - 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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:A message containing letters fromA-Zis being encoded to numbers using the following mapping: Given an encoded message containing digits, determine the
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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.
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文

浙公网安备 33010602011771号