Company: BNY Codedivas 2026
Difficulty: medium
House Cleaning Jim has been hired as a CEO for a cleaning company. He was impressed by the number of order his company is recieving from a city where each house is represented by a coordinate and not by any specific number. The company recieves N number of orders from that city in a day. In order to deliver the service efficiently, Jim made the following rule: An employee must only visit those houses which are either in a single row or a single column. This means that the employees will either clean the houses row wise or column wise. In order to make sure his employees are working as directed, he needs your help in finding the minimum number of employees required to get the job done, i.e., to cover all the houses. Your are given a 2D integer array A , containing the number of coordinates of N houses in the form of (x,y). Your task is to find and return an integer value denoting the minimum number of employees required to complete the job optimally. Note: The house number starts from (