LENDINGKART Hiring | On-Campus OA (2025) | Find Subsequence of Length K With the Largest Sum

Question · Posted Jun 2026

Problem Statement Given an integer array nums and an integer k, return any subsequence of length k having the maximum possible sum. The relative order of elements in the subsequence must remain the same as in the original array. Example Input nums = [2,1,3,3] k = 2 Output [3,3] Explanation The two largest values are: 3 and 3 Their original order is preserved, so the answer is: [3,3] Constraints 1 <= nums.length <= 1000 1 <= k <= nums.length -10^5 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account