CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1071. Greatest Common Divisor of Strings

For two strings s and t, we say “t divides s” if and only if s = t + … + t (i.e., t is concatenated with itself one or more times). Given two strings str1 and str2, return the largest string x su
2023-06-27
#leetcode #java #math #gcd #string

[LeetCode] 2090. K Radius Subarray Averages

You are given a 0-indexed array nums of n integers, and an integer k. The k-radius average for a subarray of nums centered at some index i with the radius k is the average of all elements in nums betw
2023-06-20
#leetcode #java #array #prefix sum #sliding window

[LeetCode] 2460. Apply Operations to an Array

You are given a 0-indexed array nums of size n consisting of non-negative integers. You need to apply n - 1 operations to this array where, in the ith operation (0-indexed), you will apply the followi
2023-06-05
#leetcode #java #array #two pointer #simulation

[LeetCode] 2559. Count Vowel Strings in Ranges

You are given a 0-indexed array of strings words and a 2D array of integers queries. Each query queries[i] = [li, ri] asks us to find the number of strings present in the range li to ri (both inc
2023-06-02
#leetcode #java #array #prefix sum #string

[LeetCode] 2441. Largest Positive Integer That Exists With Its Negative

Given an integer array nums that does not contain any zeros, find the largest positive integer k such that -k also exists in the array. Return the positive integer k. If there is no such integer, retu
2023-05-13
#leetcode #java #array #hashmap

[LeetCode] 1031. Maximum Sum of Two Non-Overlapping Subarrays

Given an integer array nums and two integers firstLen and secondLen, return the maximum sum of elements in two non-overlapping subarrays with lengths firstLen and secondLen. The array with length firs
2023-04-28
#leetcode #java #array #prefix sum

[LeetCode] 2336. Smallest Number in Infinite Set

You have a set which contains all positive integers [1, 2, 3, 4, 5, …]. Implement the SmallestInfiniteSet class:SmallestInfiniteSet() Initializes the SmallestInfiniteSet object to contain all positive
2023-04-26
#leetcode #java #hashmap #design #heap

[LeetCode] 2418. Sort the People

You are given an array of strings names, and an array heights that consists of distinct positive integers. Both arrays are of length n. For each index i, names[i] and heights[i] denote the name and he
2023-04-25
#leetcode #java #array #hashmap #sort #string

[LeetCode] 2300. Successful Pairs of Spells and Potions

You are given two positive integer arrays spells and potions, of length n and m respectively, where spells[i] represents the strength of the ith spell and potions[j] represents the strength of the jth
2023-04-03
#leetcode #java #array #sort #binary search #binary search on answer

[LeetCode] 1590. Make Sum Divisible by P

Given an array of positive integers nums, remove the smallest subarray (possibly empty) such that the sum of the remaining elements is divisible by p. It is not allowed to remove the whole array. Retu
2023-03-10
#leetcode #java #array #hashmap #MOD #prefix sum
1…1516171819…44

Search

Hexo Fluid