![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
Gongzq5
这个作者很懒,什么都没留下…
展开
-
Leetcode 003 Longest Substring Without Repeating Characters
题目如下Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given &amp原创 2018-07-25 22:12:02 · 220 阅读 · 0 评论 -
Leetcode 130. Surrounded Regions
题目Given a 2D board containing 'X' and'O'(the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.Example:X X X XX O O X...原创 2018-10-14 23:51:26 · 231 阅读 · 0 评论 -
Leetcode 773. Sliding Puzzle
题目On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0.A move consists of choosing 0 and a 4-directionally adjacent number and swapping it....原创 2018-09-30 19:14:20 · 451 阅读 · 0 评论 -
Leetcode 279. Perfect Squares
题目Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n.Example 1:Input: n = 12Output: 3 Explanation: 12 = 4 + 4 + 4.Example 2...原创 2018-10-16 15:29:04 · 157 阅读 · 0 评论 -
Leetcode 55. Jump Game
题目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 maximum jump length at that position.Determine if y...原创 2018-10-17 09:33:22 · 368 阅读 · 0 评论 -
Leetcode 063. Unique Paths II
https://leetcode.com/problems/unique-paths-ii/description/题目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 r...原创 2018-10-27 01:21:47 · 174 阅读 · 0 评论 -
Leetcode 120. Triangle
题目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 following triangle[ [2], [3,4], [6,5...原创 2018-11-02 16:58:18 · 168 阅读 · 0 评论 -
Leetcode 152. Maximum Product Subarray
题目Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product.Example 1:Input: [2,3,-2,4]Output: 6Explanation: [2,3] ...原创 2018-11-10 09:41:14 · 173 阅读 · 0 评论 -
Leetcode 264. Ugly Number II
Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.Example:Input: n = 10Output: 12Explanation: 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 ...原创 2018-11-15 16:07:49 · 212 阅读 · 0 评论 -
LeetCode 87. Scramble String(补上周)
题目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 representation of s1 = "great": great / \ gr ...原创 2018-12-03 21:36:46 · 191 阅读 · 0 评论 -
Leetcode 200. Number of Islands
题目Given a 2d grid map of '1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assu...原创 2018-10-14 22:55:54 · 168 阅读 · 0 评论 -
Leetcode 310. Minimum Height Trees
For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees, those with minimum height are called mini...原创 2018-10-07 22:24:44 · 211 阅读 · 0 评论 -
Leetcode 004 Median of Two Sorted Arrays
Leetcode 004 Median of Two Sorted Arrays题目My Solution (O(n) not O(logn))分析Leetcode 004 Median of Two Sorted Arrays写出给定的两个数组中所有数字的中位数题目There are two sorted arrays nums1 and nums2 ...原创 2018-07-26 14:50:03 · 181 阅读 · 0 评论 -
Leetcode 11. Container With Most Water
Leetcode 11. Container With Most Water题目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 endpoints ...原创 2018-07-31 11:33:28 · 155 阅读 · 0 评论 -
Leetcode 005 Longest Palindromic Substring
Leetcode 005 Longest Palindromic Substring题目Solution分析Leetcode 005 Longest Palindromic Substring找到一个字符串中最长的回文串题目Given a string s, find the longest palindromic substring in s. ...原创 2018-07-27 23:06:12 · 173 阅读 · 0 评论 -
Leetcode 15. 3Sum
Leetcode 15. 3Sum题目Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The s...原创 2018-08-03 10:41:08 · 262 阅读 · 0 评论 -
Leetcode 31. Next Permutation
Leetcode 31. Next Permutation题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it mu...原创 2018-08-12 23:24:59 · 210 阅读 · 0 评论 -
Leetcode 215. Kth Largest Element in an Array
Leetcode 215. Kth Largest Element in an Array题目Find the **k**th largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element....原创 2018-09-09 16:18:24 · 188 阅读 · 0 评论 -
Leetcode 240. Search a 2D Matrix II
Leetcode 240. Search a 2D Matrix II题目Solution with O(n2) or O(nlogn)分析Solution with O(nlogn)分析Solution with O(nlog3) = O(n1.58)分析Solution with O(m+n)分析Leetcode 240. Search...原创 2018-09-13 21:12:07 · 560 阅读 · 0 评论 -
Leetcode 207. Course Schedule
Leetcode 207. Course Schedule题目There are a total of n courses you have to take, labeled from 0 to n-1.Some courses may have prerequisites, for example to take course 0 you have to first take cours...原创 2018-09-23 02:11:56 · 165 阅读 · 0 评论 -
Leetcode 134. Gas Station
题目There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to it...原创 2018-10-17 21:22:44 · 191 阅读 · 0 评论 -
Leetcode 97. Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.Example 1:Input: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"Output: trueExample 2:Input: s1 = "aabcc&quo原创 2018-12-11 17:07:28 · 171 阅读 · 0 评论