- 博客(20)
- 收藏
- 关注
原创 [LeetCode] Longest Increasing Path in a Matrix
Description Longest 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
190
原创 [LeetCode] Shortest Distance to Target Color
Description Shortest 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
199
原创 [LeetCode] Longest Line of Consecutive One in Matrix
Description Longest 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
198
原创 [LeetCode] K Closest Points to Origin
Description K 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
152
原创 [LeetCode] Minimum ASCII Delete Sum for Two Strings
Description Minimum 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: 231 Explanation: Deleting "s" from "sea" adds the
2021-09-16 10:22:14
145
原创 [LeetCode] Maximum Number of Points with Cost
Description Maximum 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
244
原创 [LeetCode] Best Sightseeing Pair
Description Best 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
180
原创 [LeetCode] Jump Game II
Description Jump 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
159
原创 [LeetCode] Count All Valid Pickup and Delivery Options
Description Count 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
159
原创 [LeetCode] Sum of Subarray Minimums
Description Sum 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
189
原创 [LeetCode] Sudoku Solver
Description Sudoku 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
148
原创 [LeetCode] Valid Sudoku
Description Valid 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
130
原创 [LeetCode] Add Strings
Description Add 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" Solution The basic idea is to add the numbers one by one fr
2021-08-09 16:09:49
116
原创 [LeetCode] Minimum Total Space Wasted With K Resizing Operations
Description Minimum 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
201
原创 [LeetCode] ZigZag Conversion
Description ZigZag 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 N A P L S I I G Y I R And then read
2021-08-07 14:59:18
139
原创 [LeetCode] Longest Palindromic Substring
Description Longest 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. Solution The basic idea for this question is to use dynamic programmi
2021-08-05 18:26:31
123
原创 [LeetCode] Median of Two Sorted Arrays
Description Median 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.00000 Explanation: merged array = [1,2
2021-08-05 15:50:50
120
原创 [LeetCode] Longest Substring Without Repeating Characters
Description Longest Substring Without Repeating Characters: Given a string s, find the length of the longest substring without repeating characters. Example: Input: s = "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. Notice that
2021-08-05 00:33:14
110
原创 [LeetCode] Add Two Numbers
Description Add 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
130
原创 [LeetCode] Two Sum
Description Given 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 = 9 Output: [0,1] Output: Because nums[0] + nums[1] == 9, we return [0, 1]. So
2021-08-04 16:26:33
110
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅