All Posts
Leetcode 2825: Make String a Subsequence Using Cyclic Increments
Given two strings, str1 and str2, you can perform an operation on str1 where you select a set of indices and increment the characters at those indices cyclically. The task is to check if it is possible to make str2 a subsequence of str1 by performing the operation at most once.
Leetcode 2856: Minimum Array Length After Pair Removals
You are given a non-decreasing sorted integer array. Perform operations to remove pairs of elements where nums[i] < nums[j] and return the minimum length of the array after the operations.
Leetcode 2903: Find Indices With Index and Value Difference I
You are given a 0-indexed array of integers nums of length n, along with two integers, indexDifference and valueDifference. Your task is to find two indices i and j such that the difference between the indices is greater than or equal to indexDifference, and the absolute difference between the values at the indices is greater than or equal to valueDifference. Return the indices [i, j] if such a pair exists, otherwise return [-1, -1].
Leetcode 2905: Find Indices With Index and Value Difference II
You are given an integer array nums of size n, an integer indexDifference, and an integer valueDifference. Your task is to find two indices i and j that satisfy the following conditions:
- abs(i - j) >= indexDifference,
- abs(nums[i] - nums[j]) >= valueDifference.
Return the indices [i, j] if such a pair exists, or [-1, -1] if no such pair exists. If there are multiple pairs, any valid pair is acceptable.