随笔分类 - Leetcode+题
摘要:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist
阅读全文
摘要: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 ="ADOBECODE
阅读全文
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array[−2,1,−3,4,−1,2,1
阅读全文
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim
阅读全文
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim
阅读全文
摘要:There are N gas stations along a circular route, where the amount of gas at station i isgas[i]. You have a car with an unlimited gas tank and it costs
阅读全文
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan
阅读全文
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "
阅读全文
摘要:Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho
阅读全文
摘要: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
阅读全文
摘要:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled wit
阅读全文
摘要:Given a set of candidate numbers ( C ) and a target number ( T ), find all unique combinations in C where the candidate numbers sums to T . The same r
阅读全文
摘要:Given a collection of candidate numbers ( C ) and a target number ( T), find all unique combinations in C where the candidate numbers sums to T . Each
阅读全文
摘要:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or
阅读全文
摘要:Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the or
阅读全文
摘要:Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac
阅读全文
摘要:Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a functio
阅读全文
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2). You are given a target value
阅读全文
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: 题意:给定1...n个数,
阅读全文
摘要:Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 题意:仅要求给出解的种数。 思路:这题是n que
阅读全文

浙公网安备 33010602011771号