Company: PhonePe

Difficulty: medium

Problem Statement

The Dynasty Of Capybara Mira and Kabir run payroll analytics for a mid-sized manufacturing firm. Their compensation structure splits every employee into pay bands, and each band is defined only by a minimum and maximum salary. An employee is considered part of a band whenever their salary falls between that band's minimum and maximum, inclusive on both ends. Because the bands can overlap, a single employee may qualify for several bands at once. You are given k, the number of pay bands, along with Ai and Bi, the lower and upper salary limits of band i. You are also given n, the number of employees, along with Si, the salary drawn by employee i. Determine which band contains the greatest number of employees. When several bands tie for the top count, report the one with the smallest index. If not a single employee falls inside any band, report index 1 regardless. Input Format The first line holds two integers, k and n. Each of the next k lines holds two integers Ai and Bi. Also Ai+1>=A

More PhonePe OA questionsInterview experiences