Count Fully-Surrounded Robots

Asked at Amazon · Coding Questions · Difficulty: Medium

Robots sit at distinct integer coordinates given by parallel arrays `x` and `y`. A robot is *idle* if there exists another robot directly above it (same x, larger y), directly below (same x, smaller y), directly left (same y, smaller x), and directly right (same y, larger x). Return the number of idle robots.

Loading the problem…