#3661

Maximum Walls Destroyed by Robots

international master · 2075 · lc hard +32 · 26.4% accepted · 53 likes · top 4%

Description

On an infinite line, robots at positions robots[i] each fire one bullet left or right up to distance[i] meters. Walls at positions walls[j] are destroyed if a bullet passes through them within range. Bullets stop upon hitting another robot. Robots and walls may share positions (the co-located wall can be destroyed). Return the maximum number of unique walls destroyable across all robots.

Code

1
2
3