原文链接: https://leetcode-cn.com/problems/minimum-swaps-to-make-strings-equal 英文原文You are given two strings s1 and s2 of equal length consisting of letters "x" and "y" only. Your task is to make these two strings equal to each other. You can swap any tw…
标签详情
数学 分类
原文链接: https://leetcode-cn.com/problems/count-number-of-nice-subarrays 英文原文Given an array of integers nums and an integer k. A continuous subarray is called nice if there are k odd numbers on it. Return the number of nice sub-arrays. Example 1: Input:…
原文链接: https://leetcode-cn.com/problems/check-if-it-is-a-good-array 英文原文Given an array nums of positive integers. Your task is to select some subset of nums, multiply each element by an integer and add all these numbers. The array is said to be good i…
原文链接: https://leetcode-cn.com/problems/cells-with-odd-values-in-a-matrix 英文原文There is an m x n matrix that is initialized to all 0's. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed location to perform some in…
原文链接: 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/number-of-burgers-with-no-waste-of-ingredients 英文原文Given two integers tomatoSlices and cheeseSlices. The ingredients of different burgers are as follows: Jumbo Burger: 4 tomato slices and 1 cheese slice. Small B…
原文链接: 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-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/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/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/angle-between-hands-of-a-clock 英文原文Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand. Example 1: Input: hour = 12, minutes = 30 Output: 165 Ex…
原文链接: 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/product-of-the-last-k-numbers 英文原文Design an algorithm that accepts a stream of integers and retrieves the product of the last k integers of the stream. Implement the ProductOfNumbers class: ProductOfNumbers() In…
原文链接: 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/circle-and-rectangle-overlapping 英文原文Given a circle represented as (radius, x_center, y_center) and an axis-aligned rectangle represented as (x1, y1, x2, y2), where (x1, y1) are the coordinates of the bottom-lef…
原文链接: 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/max-difference-you-can-get-from-changing-an-integer 英文原文You are given an integer num. You will apply the following steps exactly two times: Pick a digit x (0 <= x <= 9). Pick another digit y (0 <= y <= 9). The d…
原文链接: https://leetcode-cn.com/problems/simplified-fractions 英文原文Given an integer n, return a list of all simplified fractions between 0 and 1 (exclusive) such that the denominator is less-than-or-equal-to n. The fractions can be in any order. Example…
原文链接: https://leetcode-cn.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor 英文原文Given an array of integers arr. We want to select three indices i, j and k where (0 <= i < j <= k < arr.length). Let's define a and b as follows: a = arr[…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-darts-inside-of-a-circular-dartboard 英文原文You have a very large square wall and a circular dartboard placed on the wall. You have been challenged to throw darts into the board blindfolded. Darts…
原文链接: https://leetcode-cn.com/problems/allocate-mailboxes 英文原文Given the array houses and an integer k. where houses[i] is the location of the ith house along a street, your task is to allocate k mailboxes in the street. Return the minimum total dista…
原文链接: https://leetcode-cn.com/problems/probability-of-a-two-boxes-having-the-same-number-of-distinct-balls 英文原文Given 2n balls of k distinct colors. You will be given an integer array balls of size k where balls[i] is the number of balls of color i. A…
原文链接: https://leetcode-cn.com/problems/the-kth-factor-of-n 英文原文Given two positive integers n and k. A factor of an integer n is defined as an integer i where n % i == 0. Consider a list of all factors of n sorted in ascending order, return the kth fa…
原文链接: https://leetcode-cn.com/problems/longest-subarray-of-1s-after-deleting-one-element 英文原文Given a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray containing only 1's in the resulting arra…
原文链接: https://leetcode-cn.com/problems/xor-operation-in-an-array 英文原文Given an integer n and an integer start. Define an array nums where nums[i] = start + 2*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. Example 1…
原文链接: https://leetcode-cn.com/problems/stone-game-iv 英文原文Alice and Bob take turns playing a game, with Alice starting first. Initially, there are n stones in a pile. On each player's turn, that player makes a move consisting of removing any non-zero …
原文链接: https://leetcode-cn.com/problems/count-odd-numbers-in-an-interval-range 英文原文Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). Example 1: Input: low = 3, high = 7 Output: 3 Explanatio…
原文链接: https://leetcode-cn.com/problems/number-of-sub-arrays-with-odd-sum 英文原文Given an array of integers arr, return the number of subarrays with an odd sum. Since the answer can be very large, return it modulo 109 + 7. Example 1: Input: arr = [1,3,5]…