Given an array arr[] of positive integers and an integer k, Your task is to return k largest elements in decreasing order.

https://www.geeksforgeeks.org/batch/gfg-160-problems/track/heap-gfg-160/problem/k-largest-elements4206

class Solution {
  public:
    vector<int> kLargest(vector<int>& arr, int k) {
           
        sort(arr.begin(), arr.end() , greater<int>());
        vector <int > res(arr.begin(), arr.begin()+k);
        
        return res;
    }
};

works but the time complexity for the sort……