Question bank › Heap
Dsa Heap Medium

Kth Largest Product of Tasks

You are given a list of products represented by positive integers. You need to find the Kth largest product that can be formed by selecting any two products. For example, if the products are [4, 1, 3, 8, 6] and K = 3, the subsets of products are (8*6, 8*4, 8*3, 8*1, etc.). You may not use a product twice in the same selection for creating the product. Input Format: - The first line contains an integer N (1 <= N <= 1000), the number of products. - The second line contains N integers (1 <= products[i] <= 10^6), representing the product values. - The third line contains an integer K (1 <= K <= N*(N-1)/2), representing the Kth position of the product. Output Format: - Print the Kth largest product. Example: Input: 5 4 1 3 8 6 3 Output: 24

Key concepts

heappriority queuesorting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.