随笔分类 - leetcode
摘要:1.题目描述 Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp...
阅读全文
摘要:1.题目描述 Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element...
阅读全文
摘要:1.题目描述 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 ...
阅读全文
摘要:1.题目描述 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 ...
阅读全文
摘要:1.题目描述Givenasetofcandidatenumbers(C)andatargetnumber(T),findalluniquecombinationsinCwherethecandidatenumberssumstoT.ThesamerepeatednumbermaybechosenfromCunlimitednumberoftimes.Note:Allnumbers(includingtarget)willbepositiveintegers.Elementsinacombination(a1,a2,。。。,ak)mustbeinnon-descendingorder.(ie,a
阅读全文
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac...
阅读全文
摘要:1.题目描述 Given an array of non-negative integers, you are initially positioned at the first index of the array. Eac...
阅读全文
摘要:1.题目描述 Implement int sqrt(int x). Compute and return the square root of x. 2.解法分析...
阅读全文
摘要:1.题目描述 Given a number represented as an array of digits, plus one to the number. 2.解法分析 不要被常规思路限制住,常规思路会遍历整个数组...
阅读全文
摘要:1.题目描述 Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2...
阅读全文
摘要:1.题目描述 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). ...
阅读全文
摘要:1.题目描述 Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, ...
阅读全文
摘要:1.题目描述Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of elements initialized in A and B are m and n respectively.2.解法分析这道题是归并排序的变种,我们知道,归并那一步应该是要有一个O(N+M)的辅助数组的,由于题目中说可以假设A有足够的空间来容
阅读全文
摘要:1.题目描述 Given an unsorted integer array, find the first missing positive integer. For example, Given ...
阅读全文
摘要:1.题目描述 Divide two integers without using multiplication, division and mod operator. 2.解法分析 不用乘除求模运算,一个很容易让人想到的就是用...
阅读全文
摘要:1.题目描述 Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is ...
阅读全文
摘要:1.题目描述 Given an array and a value, remove all instances of that value in place and return the new length. The ord...
阅读全文
摘要:1.题目描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. ...
阅读全文
摘要:1.题目描述 Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1-...
阅读全文
摘要:1.题目描述 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 2.解法分析 ...
阅读全文

浙公网安备 33010602011771号