8 questions. Covers Top-k with a heap.
Questions 1 to 5 of 8
cpp #include <iostream> #include <map> int main() { std::map<int, int> freq; for (int x : {3, 1, 3, 2, 3, 1}) ++freq[x]; std::cout << freq[7] << ' ' << freq.size() << '\n'; }
cpp #include <functional> #include <iostream> #include <queue> #include <vector> int main() { std::priority_queue<int, std::vector<int>, std::greater<int>> heap; for (int x : {42, 7, 19}) heap.push(x); heap.pop(); std::cout << heap.top() << ' ' << heap.size() << '\n'; }
Pick every answer that is true.
Use the arrows to put the steps in order.
seen[need]
need
seen
4 question(s) left on this page.