Company: Curefit SDE3_15july

Difficulty: easy

Problem Statement

During an emergency, a logistics company must distribute fuel to N cities. City i requires exactly cityDemand[i] units of fuel to keep operating. There are M supply stations; station j holds stationSupply[j] units. A city can be served only by a single station , and a station can serve at most one city . A station j can serve city i only when stationSupply[j] ≥ cityDemand[i] (the city must receive its complete requirement; leftover fuel at that station is wasted). Compute the maximum number of cities whose demand can be fully met. If no city can be served, print 0 . Input Format First line: one integer N (number of cities). Second line: one integer M (number of supply stations). Third line: N space-separated integers — cityDemand[i] . Fourth line: M space-separated integers — stationSupply[j] . Output Format A single integer: the maximum number of cities whose demands can be fully met. Constraints 1 ≤ N, M ≤ 10 5 1 ≤ cityDemand[i], stationSupply[j] ≤ 10 6 Sam

More Curefit SDE3_15july OA questionsInterview experiences