2929. Distribute Candies Among Children II
You are given two positive integers n and limit. Return the total number of ways to distribute n candies among 3 children such that no child gets more than limit candies. Example […]
You are given two positive integers n and limit. Return the total number of ways to distribute n candies among 3 children such that no child gets more than limit candies. Example […]
You are given an n x n integer matrix board where the cells are labeled from 1 to n2 in a Boustrophedon style starting from the bottom left of the
You are given an integer array nums and two integers minK and maxK. A fixed-bound subarray of nums is a subarray that satisfies the following conditions: The minimum value in the
You are given a 0-indexed integer array nums, an integer modulo, and an integer k. Your task is to find the count of subarrays that
You are given an array nums consisting of positive integers. We call a subarray of an array complete if the following condition is satisfied: The number
You are given an integer n. Each number from 1 to n is grouped according to the sum of its digits. Return the number of groups
You are given two integers n and maxValue, which are used to describe an ideal array. A 0-indexed integer array arr of length n is considered ideal if the following conditions hold: Every arr[i] is
You are given a 0-indexed array of n integers differences, which describes the differences between each pair of consecutive integers of a hidden sequence of length (n + 1). More formally, call
There is a forest with an unknown number of rabbits. We asked n rabbits “How many rabbits have the same color
Given a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) where 0 <= i < j < n, such that nums[i] == nums[j] and (i *
You are given an integer array nums. You need to ensure that the elements in the array are distinct. To achieve this,
Given an integer array nums, return true if you can partition the array into two subsets such that the sum of the elements