The Banana Company employs small, autonomous transport units, known as "Bananaer", to efficiently carry large stacks of products within its warehouses. These Bananaer navigate along predefined paths in a warehouse, which can be represented as a Cartesian plane. Each Bananaer is stationed at distinct integral coordinate points of the form (x, y).
When a product needs to be delivered to a specific location (i, j), the system selects the nearest available Bananaer to complete the task. However, some Bananaers may seldom be chosen due to being surrounded by other units.
A Bananaer is considered idle if it has another Bananaer positioned directly above, below, to the left, and to the right of it. This means it is entirely enclosed and less likely to be selected for work. It is guaranteed that no two Bananaers share the same coordinates.
Given the locations of n Bananaers on the Cartesian plane, determine how many Bananers are idle based on the above criteria.
x = [0, 0, 0, 0, 0, 1, 1, 1, 2, -1, -1, -2, -1] y = [-1, 0, 1, 2, -2, 0, 1, -1, 0, 1, -1, 0, 0] return = 5

x = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3] y = [1, 2, 3, 1, 2, 3, 5, 1, 2, 3] return = 2

1 ≤ n ≤ 105-109 ≤ x[i], y[i] ≤ 109
- Count Promotional PeriodsOA · Seen Jun 2026
- Find Maximum Total Amount (SDE I, Fungible :)Seen Jun 2026
- Get Minimum AmountOA · Seen Jun 2026
- Find Minimum CostOA · Seen Jun 2026
- Get Smallest Base SegmentOA · Seen Jun 2026
- Select Least Resource TasksOA · Seen Jun 2026
- Product Category Group SizesPHONE SCREEN · Seen May 2026
- Count Connected ComponentsPHONE SCREEN · Seen May 2026
public int numIdleDrives(int[] x, int[] y) {
// write your code here
}