From ec7cb87be4d76493930028aa27bb5dbd390827da Mon Sep 17 00:00:00 2001 From: chayan das Date: Sat, 28 Jun 2025 13:50:40 +0530 Subject: [PATCH] Create 2099. Find Subsequence of Length K With the Largest Sum --- ...bsequence of Length K With the Largest Sum | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 2099. Find Subsequence of Length K With the Largest Sum diff --git a/2099. Find Subsequence of Length K With the Largest Sum b/2099. Find Subsequence of Length K With the Largest Sum new file mode 100644 index 0000000..1ee40dd --- /dev/null +++ b/2099. Find Subsequence of Length K With the Largest Sum @@ -0,0 +1,19 @@ +class Solution { +public: + vector maxSubsequence(vector& nums, int k) { + vector>ans; + vectorarr; + for(int i=0; ip2.second; + }; + sort(ans.begin(), ans.end(), lambda); + sort(ans.begin(), ans.begin()+k); + for(int i=0; i