GOOGLE OA IIT 2023
Google · Question · Posted Oct 2023
//cookies google oa iit //jayesh #include<bits/stdc++.h> using namespace std; vector<int> maxCookiesAndEnergy(int N, vector<int>& H, int K, vector<int> &E) { priority_queue<pair<int, int>> q; vector<int> ans, ans1; for (int i = 0; i < N; i++) { q.push(make_pair(E[i], i)); } int en = K; // Alice's initial energy queue<int> reserve; while (!q.empty()) { int en1 = q.top().first; ...
The full answer & interview discussion are available to premium members.
Log in Create a free account