Opening your workspace…
Workspace/Coding room
Opening your workspace…
You're at the Bus Stop with 500g for a ticket to Calico Desert, but Pam is late. You can check back between farm chores. Given the times you're willing to wait and the times Pam is at the wheel, return the earliest time you can buy a ticket and leave. Return -1 if you miss her all day.
[[900,1100]], [[1020,1700]]Output1020You're still waiting when Pam takes the wheel at 10:20.
[[1500,1530],[940,1000],[1210,1240]], [[1400,1700],[1000,1300]]Output1210You leave just as Pam arrives at 10:00. She's still there when you return at 12:10, so you can catch the bus before your 15:00 visit.
Sort both lists by start time, then advance the interval that ends first.
function solve(visits, shifts) { // 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.