CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 910. Smallest Range II

You are given an integer array nums and an integer k. For each index i where 0 <= i < nums.length, change nums[i] to be either nums[i] + k or nums[i] - k. The score of nums is the differenc
2024-10-20
#leetcode #java #array #greedy #sort #math

[LeetCode] 1545. Find Kth Bit in Nth Binary String

Given two positive integers n and k, the binary string Sn is formed as follows:S1 = “0”Si = Si - 1 + “1” + reverse(invert(Si - 1)) for i > 1Where + denotes the concatenation operation, re
2024-10-19
#leetcode #java #recursion #string #simulation

[LeetCode] 908. Smallest Range I

You are given an integer array nums and an integer k. In one operation, you can choose any index i where 0 <= i < nums.length and change nums[i] to nums[i] + x where x is an integer from th
2024-10-19
#leetcode #java #array #math

[LeetCode] 2406. Divide Intervals Into Minimum Number of Groups

You are given a 2D integer array intervals where intervals[i] = [left, right] represents the inclusive interval [left, right]. You have to divide the intervals into one or more groups such that e
2024-10-12
#leetcode #java #array #greedy #sort #heap #line sweep

[LeetCode] 962. Maximum Width Ramp

A ramp in an integer array nums is a pair (i, j) for which i < j and nums[i] <= nums[j]. The width of such a ramp is j - i. Given an integer array nums, return the maximum width of a ramp i
2024-10-10
#leetcode #java #array #stack #monotonic stack

[LeetCode] 2491. Divide Players Into Teams of Equal Skill

You are given a positive integer array skill of even length n where skill[i] denotes the skill of the ith player. Divide the players into n / 2 teams of size 2 such that the total skill of each t
2024-10-04
#leetcode #java #array #two pointer

[LeetCode] 1497. Check If Array Pairs Are Divisible by k

Given an array of integers arr of even length n and an integer k. We want to divide the array into exactly n / 2 pairs such that the sum of each pair is divisible by k. Return true If you can fin
2024-10-01
#leetcode #java #array #hashmap #math

[LeetCode] 641. Design Circular Deque

Design your implementation of the circular double-ended queue (deque). Implement the MyCircularDeque class:MyCircularDeque(int k) Initializes the deque with a maximum size of k.boolean insertFront() A
2024-09-28
#leetcode #java #design #linked list #queue

[LeetCode] 2414. Length of the Longest Alphabetical Continuous Substring

An alphabetical continuous string is a string consisting of consecutive letters in the alphabet. In other words, it is any substring of the string “abcdefghijklmnopqrstuvwxyz”. For example, “abc” is a
2024-09-19
#leetcode #java #two pointer #string

[LeetCode] 884. Uncommon Words from Two Sentences

A sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is uncommon if it appears exactly once in one of the sentences, and does not appear in
2024-09-17
#leetcode #java #hashmap #string
1…56789…41

Search

Hexo Fluid