Jobra drops you into a broken repo. Find it, fix it, ship it. AI helps you debug like on the job.
Jobra drops you into a broken repo. Find it, fix it, ship it. AI helps you debug like on the job.
This is a verified interview question from Meltwater. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Two Sets Distribution Meltwater - IIT Hyderabad" covers key patterns like Other.
"**Mode:** On-Campus **Exam Pattern:** 3 coding **OA Date:** 2026-11-10 ## Two Sets Distribution You are given four positive integers n1, n2, a, and b. Your task is to choose two disjoint sets of positive integers, S1 and S2, such that the following conditions are met simultaneously: The size of set S1 is exactly n1 (i.e., |S1| = n1). The size of set S2 is exactly n2 (i.e., |S2| = n2). The sets are disjoint (they share no common elements). No element in S1 is divisible by a. No element in S2 is divisible by b. Let v be the maximum integer present in either S1 or S2. Find the minimum possible value of v among all valid choices of sets S1 and S2. Input The first and only line of input contains four space-separated integers n1, n2, a, and b. 1 <= n1, n2 <= 10^9 2 <= a, b <= 10^9 Output Print a single integer — the minimum possible value of the maximum element in the two sets."
Join thousands of developers practicing for Meltwater.