- 博客(20)
- 收藏
- 关注
原创 [LeetCode] Longest Increasing Path in a Matrix
DescriptionLongest Increasing Path in a Matrix: Given an m x n integers matrix, return the length of the longest increasing path in matrix.From each cell, you can either move in four directions: left, right, up, or down. You may not move diagonally or mo
2021-09-25 03:48:06
104
原创 [LeetCode] Shortest Distance to Target Color
DescriptionShortest Distance to Target Color: You are given an array colors, in which there are three colors: 1, 2 and 3.You are also given some queries. Each query consists of two integers i and c, return the shortest distance between the given index i
2021-09-24 08:08:21
129
原创 [LeetCode] Longest Line of Consecutive One in Matrix
DescriptionLongest Line of Consecutive One in Matrix: Given an m x n binary matrix mat, return the length of the longest line of consecutive one in the matrix.The line could be horizontal, vertical, diagonal, or anti-diagonal.Example:Input: mat = [[0,1
2021-09-23 02:52:27
117
原创 [LeetCode] K Closest Points to Origin
DescriptionK Closest Points to Origin: Given an array of points where points[i] = [xi, yi] represents a point on the X-Yplane and an integer k, return the k closest points to the origin (0, 0).The distance between two points on the X-Y plane is the Eucli
2021-09-22 09:56:51
89
原创 [LeetCode] Minimum ASCII Delete Sum for Two Strings
DescriptionMinimum ASCII Delete Sum for Two Strings: Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal.Example:Input: s1 = "sea", s2 = "eat"Output: 231Explanation: Deleting "s" from "sea" adds the
2021-09-16 10:22:14
77
原创 [LeetCode] Maximum Number of Points with Cost
DescriptionMaximum Number of Points with Cost: You are given an m x n integer matrix points (0-indexed). Starting with 0points, you want to maximize the number of points you can get from the matrix.To gain points, you must pick one cell in each row. Pick
2021-09-14 01:17:35
139
原创 [LeetCode] Best Sightseeing Pair
DescriptionBest Sightseeing Pair: You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance j - i between them.The score of a pair (i < j) of sightseeing spots
2021-08-26 19:35:52
106
原创 [LeetCode] Jump Game II
DescriptionJump Game II: Given an array of non-negative integers nums, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to reach the last index in th
2021-08-23 17:34:21
80
原创 [LeetCode] Count All Valid Pickup and Delivery Options
DescriptionCount All Valid Pickup and Delivery Options: Given n orders, each order consist in pickup and delivery services.Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i).Since the answer may be too
2021-08-21 14:47:46
90
原创 [LeetCode] Sum of Subarray Minimums
DescriptionSum of Subarray Minimums: Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be large, return the answer modulo 109 + 7.Example:Input: arr = [3,1,2,4]Output: 1
2021-08-16 12:32:42
91
原创 [LeetCode] Sudoku Solver
DescriptionSudoku Solver: Write a program to solve a Sudoku puzzle by filling the empty cells.A sudoku solution must satisfy all of the following rules:Each of the digits 1-9 must occur exactly once in each row.Each of the digits 1-9 must occur exactl
2021-08-12 21:54:21
70
原创 [LeetCode] Valid Sudoku
DescriptionValid Sudoku: Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition.Each column must contain the digits 1-9 without rep
2021-08-11 14:50:55
66
原创 [LeetCode] Add Strings
DescriptionAdd Strings: Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.Example:Input: num1 = "456", num2 = "77"Output: "533"SolutionThe basic idea is to add the numbers one by one fr
2021-08-09 16:09:49
52
原创 [LeetCode] Minimum Total Space Wasted With K Resizing Operations
DescriptionMinimum Total Space Wasted With K Resizing Operations: You are currently designing a dynamic array. You are given a 0-indexed integer array nums, where nums[i] is the number of elements that will be in the array at time i. In addition, you are
2021-08-08 16:03:11
115
原创 [LeetCode] ZigZag Conversion
DescriptionZigZag Conversion: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I GY I RAnd then read
2021-08-07 14:59:18
70
原创 [LeetCode] Longest Palindromic Substring
DescriptionLongest Palindromic Substring: Given a string s, return the longest palindromic substring in s.Example:Input: s = "babad"Output: "bab"Note: "aba" is also a valid answer.SolutionThe basic idea for this question is to use dynamic programmi
2021-08-05 18:26:31
57
原创 [LeetCode] Median of Two Sorted Arrays
DescriptionMedian of Two Sorted Arrays: Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.Example:Input: nums1 = [1,2,3,4,5], nums2 = [2,3,7]Output: 3.00000Explanation: merged array = [1,2
2021-08-05 15:50:50
62
原创 [LeetCode] Longest Substring Without Repeating Characters
DescriptionLongest Substring Without Repeating Characters: Given a string s, find the length of the longest substring without repeating characters.Example:Input: s = "pwwkew"Output: 3Explanation: The answer is "wke", with the length of 3.Notice that
2021-08-05 00:33:14
57
原创 [LeetCode] Add Two Numbers
DescriptionAdd Two Numbers: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
2021-08-04 20:57:29
62
原创 [LeetCode] Two Sum
DescriptionGiven an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.Example:Input: nums = [2,7,11,15], target = 9Output: [0,1]Output: Because nums[0] + nums[1] == 9, we return [0, 1].So
2021-08-04 16:26:33
48
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人