[InterviewBit] Edit DistanceRead more
[InterviewBit] Min Jumps ArrayRead more
[InterviewBit] Min Sum Path in MatrixRead more
[InterviewBit] Palindrome Partitioning IIRead more
[InterviewBit] Dungeon PrincessRead more
[LeetCode] Longest Increasing Subsequence II

2407. Longest Increasing Subsequence II

You are given an integer array nums and an integer k.

Find the longest subsequence of nums that meets the following requirements:

  • The subsequence is strictly increasing and
  • The difference between adjacent elements in the subsequence is at most k.

Return the length of the longest subsequence that meets the requirements.

A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.

Read more
[LeetCode] Divide Intervals Into Minimum Number of Groups

2406. Divide Intervals Into Minimum Number of Groups

You are given a 2D integer array intervals where intervals[i] = [lefti, righti] represents the inclusive interval [lefti, righti].

You have to divide the intervals into one or more groups such that each interval is in exactly one group, and no two intervals that are in the same group intersect each other.

Return the minimum number of groups you need to make.

Two intervals intersect if there is at least one common number between them. For example, the intervals [1, 5] and [5, 8] intersect.

Read more
[LeetCode] Optimal Partition of String

2405. Optimal Partition of String

Given a string s, partition the string into one or more substrings such that the characters in each substring are unique. That is, no letter appears in a single substring more than once.

Return the minimum number of substrings in such a partition.

Note that each character should belong to exactly one substring in a partition.

Read more
[LeetCode] Most Frequent Even Element

2404. Most Frequent Even Element

Given an integer array nums, return the most frequent even element.

If there is a tie, return the smallest one. If there is no such element, return -1.

Read more
[Hacker Cup 2022 Round 1] Problem B2: Watering Well - Chapter 2Read more