:facepalm: no wonder it rang a bell… I thought, “I wonder if these are the same folks” and even looked at their route map but somehow missed that key detail. Appreciate the graceful response :)
Naive micro-optimization of your program (namely, things like FF is 1 char shorter than [F]) got that down to 40 chars:
[[[[[[[[[[[[[[[FF]]]]]]]RRF[RRR]]]]]]]]]
I then found a solution in 37 which uses a slightly different approach (namely, create a pattern that spans the full X and Y output space, then shift it by one step each iteration):
I was a projectionist at a local 14-plex for a couple of years back in college. It was a really excellent job for getting homework done while the machines buzzed in the background. I miss the simplicity and meditative quality of threading the machines and keeping everything on schedule, and often find myself wishing I could retreat to a job like that again. The occasional brain wrap (or worse, a thrown film) always kept us on our toes, but otherwise it was generally low stress and gave me plenty of time to think about whatever hobby I was into at the time :)
That's a better solution in general IMO, but the author's approach can guarantee that you'll never go over N calls in a sliding window rather than fixed windows. I don't believe that's possible with the timestamp + count solution. Gotta bring up both solutions and ask the interviewer what they want :)
What's the problem with a sliding window and the timestamp + count solution? lastTime is the timestamp of the last call. newTime is the timestamp of the incoming call. If newTime - lastTime > 60 seconds then you're good to proceed, set count to 1 change lastTime to newTime and go on. Otherwise, check whether count is less than n and proceed accordingly (incrementing count if so). This accomplishes the sliding window and rounding down to the last whole minute handles the fixed window - right?
Reminds me of SimTunes! "Bugs" move around the screen according to simple rules, triggering notes as they pass over them. For example: https://youtu.be/DAluHrsCKxw
>> It's to be expected that these cameras might have little impact on the behavior of police officers in Washington, D.C., he says, because this particular force went through about a decade of federal oversight to help improve the department.
Seems as though the D.C. PD didn't have many issues that needed correcting?
Could be wrong, but I believe the areas you're referring to as continuous are the areas where it takes a while for the first flip to occur (if it ever does). Once a flip happens, neighboring cells seem to diverge quite quickly.
Yeah, I think the effect would have been better had they explained what was going on immediately rather than saving it until the end. Very cool tech, regardless :)
Was hoping it would be included in the distribution, but sadly never got a response D: