原文链接: https://leetcode-cn.com/problems/number-of-ways-to-stay-in-the-same-place-after-some-steps 英文原文You have a pointer at index 0 in an array of size arrLen. At each step, you can move 1 position to the left, 1 position to the right in the array, or…
分类详情
困难 分类
原文链接: https://leetcode-cn.com/problems/palindrome-partitioning-iii 英文原文You are given a string s containing lowercase letters and an integer k. You need to : First, change some characters of s to other lowercase English letters. Then divide s into k n…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix 英文原文Given a m x n binary matrix mat. In one step, you can choose one cell and flip it and all the four neighbors of it if they exist (Flip is chang…
原文链接: https://leetcode-cn.com/problems/shortest-path-in-a-grid-with-obstacles-elimination 英文原文You are given an m x n integer matrix grid where each cell is either 0 (empty) or 1 (obstacle). You can move up, down, left, or right from and to an empty c…
原文链接: https://leetcode-cn.com/problems/maximum-candies-you-can-get-from-boxes 英文原文Given n boxes, each box is given in the format [status, candies, keys, containedBoxes] where: status[i]: an integer which is 1 if box[i] is open and 0 if box[i] is clos…
原文链接: https://leetcode-cn.com/problems/verbal-arithmetic-puzzle 英文原文Given an equation, represented by words on left side and the result on right side. You need to check if the equation is solvable under the following rules: Each character is decoded …
原文链接: https://leetcode-cn.com/problems/minimum-insertion-steps-to-make-a-string-palindrome 英文原文Given a string s. In one step you can insert any character at any index of the string. Return the minimum number of steps to make s palindrome. A Palindrom…
原文链接: https://leetcode-cn.com/problems/minimum-distance-to-type-a-word-using-two-fingers 英文原文 You have a keyboard layout as shown above in the X-Y plane, where each English uppercase letter is located at some coordinate. For example, the letter 'A' i…
原文链接: https://leetcode-cn.com/problems/jump-game-iv 英文原文Given an array of integers arr, you are initially positioned at the first index of the array. In one step you can jump from index i to index: i + 1 where: i + 1 < arr.length. i - 1 where: i - 1 …
原文链接: https://leetcode-cn.com/problems/minimum-number-of-taps-to-open-to-water-a-garden 英文原文There is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e The length of the garden is n). There are n + …
原文链接: https://leetcode-cn.com/problems/minimum-difficulty-of-a-job-schedule 英文原文You want to schedule a list of jobs in d days. Jobs are dependent (i.e To work on the i-th job, you have to finish all the jobs j where 0 <= j < i). You have to finish at…
原文链接: https://leetcode-cn.com/problems/jump-game-v 英文原文Given an array of integers arr and an integer d. In one step you can jump from index i to index: i + x where: i + x < arr.length and 0 < x <= d. i - x where: i - x >= 0 and 0 < x <= d. In additio…
原文链接: https://leetcode-cn.com/problems/maximum-students-taking-exam 英文原文Given a m * n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is denoted by a '.' character. Stud…
原文链接: https://leetcode-cn.com/problems/maximum-sum-bst-in-binary-tree 英文原文Given a binary tree root, return the maximum sum of all keys of any sub-tree which is also a Binary Search Tree (BST). Assume a BST is defined as follows: The left subtree of a…
原文链接: https://leetcode-cn.com/problems/construct-target-array-with-multiple-sums 英文原文You are given an array target of n integers. From a starting array arr consisting of n 1's, you may perform the following procedure : let x be the sum of all element…
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid 英文原文Given a m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i][j…
原文链接: https://leetcode-cn.com/problems/pizza-with-3n-slices 英文原文There is a pizza with 3n slices of varying size, you and your friends will take slices of pizza as follows: You will pick any pizza slice. Your friend Alice will pick next slice in anti …
原文链接: https://leetcode-cn.com/problems/frog-position-after-t-seconds 英文原文Given an undirected tree consisting of n vertices numbered from 1 to n. A frog starts jumping from vertex 1. In one second, the frog jumps from its current vertex to another unv…
原文链接: https://leetcode-cn.com/problems/maximum-performance-of-a-team 英文原文You are given two integers n and k and two integer arrays speed and efficiency both of length n. There are n engineers numbered from 1 to n. speed[i] and efficiency[i] represent…
原文链接: https://leetcode-cn.com/problems/reducing-dishes 英文原文A chef has collected data on the satisfaction level of his n dishes. Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is defined as the time taken to cook that dish i…
原文链接: https://leetcode-cn.com/problems/longest-happy-prefix 英文原文A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself). Given a string s, return the longest happy prefix of s. Return an empty string "" if…
原文链接: https://leetcode-cn.com/problems/find-all-good-strings 英文原文Given the strings s1 and s2 of size n and the string evil, return the number of good strings. A good string has size n, it is alphabetically greater than or equal to s1, it is alphabeti…
原文链接: https://leetcode-cn.com/problems/stone-game-iii 英文原文Alice and Bob continue their games with piles of stones. There are several stones arranged in a row, and each stone has an associated value which is an integer given in the array stoneValue. A…
原文链接: https://leetcode-cn.com/problems/number-of-ways-to-paint-n-3-grid 英文原文You have a grid of size n x 3 and you want to paint each cell of the grid with exactly one of the three colors: Red, Yellow, or Green while making sure that no two adjacent c…
原文链接: https://leetcode-cn.com/problems/number-of-ways-to-wear-different-hats-to-each-other 英文原文There are n people and 40 types of hats labeled from 1 to 40. Given a list of list of integers hats, where hats[i] is a list of all hats preferred by the i…
原文链接: https://leetcode-cn.com/problems/build-array-where-you-can-find-the-maximum-exactly-k-comparisons 英文原文Given three integers n, m and k. Consider the following algorithm to find the maximum element of an array of positive integers: You should bui…
原文链接: https://leetcode-cn.com/problems/form-largest-integer-with-digits-that-add-up-to-target 英文原文Given an array of integers cost and an integer target. Return the maximum integer you can paint under the following rules: The cost of painting a digit …
原文链接: https://leetcode-cn.com/problems/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows 英文原文You are given an m * n matrix, mat, and an integer k, which has its rows sorted in non-decreasing order. You are allowed to choose exactly 1 element fro…
原文链接: https://leetcode-cn.com/problems/number-of-ways-of-cutting-a-pizza 英文原文Given a rectangular pizza represented as a rows x cols matrix containing the following characters: 'A' (an apple) and '.' (empty cell) and given the integer k. You have to c…
原文链接: https://leetcode-cn.com/problems/cherry-pickup-ii 英文原文Given a rows x cols matrix grid representing a field of cherries. Each cell in grid represents the number of cherries that you can collect. You have two robots that can collect cherries for …