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.
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.
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.
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.
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.