Directional beam coverage
Your task
A rooftop hub aims directional beams at relay towers. Tower i sits east[i] metres east and north[i] metres north of the hub, and negative values mean west or south. One beam covers a whole ray leaving the hub, so towers lying in the same direction share a beam however far out they are, while a tower in the exactly opposite direction needs a beam of its own. A tower recorded at the hub itself, zero east and zero north, is mounted on the hub and needs no beam. Given the two offset lists, which have the same length, return how many beams the hub must install so that every tower is covered.
Examples
beams_needed(east: list[int], north: list[int]) -> intExample 1
Input
beams_needed([1, 2, 3], [2, 4, 6])Output
1Example 2
Input
beams_needed([1, -1, 0, 0], [0, 0, 1, -1])Output
4Example 3
Input
beams_needed([0, 3], [0, 0])Output
1