原文链接: https://leetcode-cn.com/problems/shift-2d-grid 英文原文Given a 2D grid of size m x n and an integer k. You need to shift the grid k times. In one shift operation: Element at grid[i][j] moves to grid[i][j + 1]. Element at grid[i][n - 1] moves to gri…
分类详情
简单 分类
原文链接: https://leetcode-cn.com/problems/minimum-time-visiting-all-points 英文原文On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points. You …
原文链接: https://leetcode-cn.com/problems/find-winner-on-a-tic-tac-toe-game 英文原文Tic-tac-toe is played by two players A and B on a 3 x 3 grid. The rules of Tic-Tac-Toe are: Players take turns placing characters into empty squares ' '. The first player A …
原文链接: https://leetcode-cn.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer 英文原文Given an integer number n, return the difference between the product of its digits and the sum of its digits. Example 1: Input: n = 234 Output: 15 Explana…
原文链接: https://leetcode-cn.com/problems/convert-binary-number-in-a-linked-list-to-integer 英文原文Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary re…
原文链接: https://leetcode-cn.com/problems/find-numbers-with-even-number-of-digits 英文原文Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contain…
原文链接: https://leetcode-cn.com/problems/find-n-unique-integers-sum-up-to-zero 英文原文Given an integer n, return any array containing n unique integers such that they add up to 0. Example 1: Input: n = 5 Output: [-7,-1,1,3,4] Explanation: These arrays als…
原文链接: https://leetcode-cn.com/problems/decrypt-string-from-alphabet-to-integer-mapping 英文原文Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are represented by…
原文链接: https://leetcode-cn.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers 英文原文Given an integer n. No-Zero integer is a positive integer which doesn't contain any 0 in its decimal representation. Return a list of two integers [A, B] wh…
原文链接: https://leetcode-cn.com/problems/number-of-steps-to-reduce-a-number-to-zero 英文原文Given an integer num, return the number of steps to reduce it to zero. In one step, if the current number is even, you have to divide it by 2, otherwise, you have t…
原文链接: https://leetcode-cn.com/problems/maximum-69-number 英文原文Given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6). Example 1: Input: num = 9…
原文链接: https://leetcode-cn.com/problems/remove-palindromic-subsequences 英文原文You are given a string s consisting only of letters 'a' and 'b'. In a single step you can remove one palindromic subsequence from s. Return the minimum number of steps to make…
原文链接: https://leetcode-cn.com/problems/sort-integers-by-the-number-of-1-bits 英文原文Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more …
原文链接: https://leetcode-cn.com/problems/the-k-weakest-rows-in-a-matrix 英文原文You are given an m x n binary matrix mat of 1's (representing soldiers) and 0's (representing civilians). The soldiers are positioned in front of the civilians. That is, all th…
原文链接: https://leetcode-cn.com/problems/check-if-n-and-its-double-exist 英文原文Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M). More formally check if there exists two indices i …
原文链接: https://leetcode-cn.com/problems/count-negative-numbers-in-a-sorted-matrix 英文原文Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid. Example 1: Input: gri…
原文链接: https://leetcode-cn.com/problems/how-many-numbers-are-smaller-than-the-current-number 英文原文Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number …
原文链接: https://leetcode-cn.com/problems/find-the-distance-value-between-two-arrays 英文原文Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. The distance value is defined as the number of elements…
原文链接: https://leetcode-cn.com/problems/generate-a-string-with-characters-that-have-odd-counts 英文原文Given an integer n, return a string with n characters such that each character in such string occurs an odd number of times. The returned string must co…
原文链接: https://leetcode-cn.com/problems/lucky-numbers-in-a-matrix 英文原文Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it is the minimum element in its…
原文链接: https://leetcode-cn.com/problems/count-largest-group 英文原文Given an integer n. Each number from 1 to n is grouped according to the sum of its digits. Return how many groups have the largest size. Example 1: Input: n = 13 Output: 4 Explanation: Th…
原文链接: https://leetcode-cn.com/problems/find-lucky-integer-in-an-array 英文原文Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value. Return a lucky integer in the array. If there are multiple …
原文链接: https://leetcode-cn.com/problems/minimum-value-to-get-positive-step-by-step-sum 英文原文Given an array of integers nums, you start with an initial positive value startValue. In each iteration, you calculate the step by step sum of startValue plus e…
原文链接: https://leetcode-cn.com/problems/minimum-subsequence-in-non-increasing-order 英文原文Given the array nums, obtain a subsequence of the array whose sum of elements is strictly greater than the sum of the non included elements in such subsequence. If…
原文链接: https://leetcode-cn.com/problems/string-matching-in-an-array 英文原文Given an array of string words. Return all strings in words which is substring of another word in any order. String words[i] is substring of words[j], if can be obtained removing …
原文链接: https://leetcode-cn.com/problems/kids-with-the-greatest-number-of-candies 英文原文There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCan…
原文链接: https://leetcode-cn.com/problems/reformat-the-string 英文原文Given alphanumeric string s. (Alphanumeric string is a string consisting of lowercase English letters and digits). You have to find a permutation of the string where no letter is followed…
原文链接: https://leetcode-cn.com/problems/maximum-score-after-splitting-a-string 英文原文Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e. left substring and right substring). The sco…
原文链接: https://leetcode-cn.com/problems/consecutive-characters 英文原文The power of the string is the maximum length of a non-empty substring that contains only one unique character. Given a string s, return the power of s. Example 1: Input: s = "leetcode…
原文链接: https://leetcode-cn.com/problems/destination-city 英文原文You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path…