All Posts

Leetcode 2054: Two Best Non-Overlapping Events

Find the maximum sum of values you can achieve by attending at most two non-overlapping events.

Leetcode 2099: Find Subsequence of Length K With the Largest Sum

You are given an integer array ’nums’ and an integer ‘k’. You need to find a subsequence of ’nums’ of length ‘k’ such that the sum of its elements is maximized. A subsequence is a sequence that can be derived from another array by deleting some or no elements without changing the order of the remaining elements. Return any subsequence with the largest sum.

Leetcode 2146: K Highest Ranked Items Within a Price Range

You are given a 2D grid representing a shop map with walls, empty spaces, and items with prices. Your task is to find the top k highest-ranked items within a given price range. The ranking is based on distance, price, row, and column number.

Leetcode 2182: Construct String With Repeat Limit

Given a string of lowercase letters and an integer limit, construct a new string such that no character appears more than the given limit times consecutively. The new string should be lexicographically largest while satisfying this condition. You can use any subset of characters from the given string.

Leetcode 2208: Minimum Operations to Halve Array Sum

You are given an array nums of positive integers. In each operation, you can reduce any number in the array by half. Your goal is to return the minimum number of operations required to reduce the sum of the array by at least half.

Leetcode 2231: Largest Number After Digit Swaps by Parity

You are given a positive integer num. You are allowed to swap any two digits of num that have the same parity (i.e., both digits are either odd or both even). The goal is to return the largest possible value of num after any number of swaps.