Opening your workspace…
Workspace/Coding room
Opening your workspace…
Stand at the Electrical panel and fake Fix Wiring. You can pick when to arrive and when to leave. For each second, nearby lists the crewmates who can see you at the panel. Each crewmate remembers how many seconds they’ve seen you there, even if they walked away in between. If anyone sees you for more than limit seconds, they call an emergency meeting. What’s the longest uninterrupted stay you can get away with? Return its length in seconds.
[["Red"],[],["Blue"],["Red"],["Blue"]], 1Output3During seconds 1 through 3, Red and Blue each see you once. Either four-second stay has a repeat witness.
[["Red","Blue"],["Red"],["Blue"],["Blue"],[]], 2Output4Stay for seconds 2 through 5. Red sees you once and Blue twice. Staying all five seconds would let Blue see you three times.
Keep sighting counts in a window. Shrink it whenever any witness exceeds the limit.
function solve(nearby, limit) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.