Here’s the video and code for the Calendar Conflicts video which walks through a linear complexity solution to a common coding interview problem. The idea is that you’re given a list of calendar events and you must find any events in the calendar which conflict.
[youtube https://www.youtube.com/watch?v=olK6SWl8UrM&w=560&h=315%5D
There is an easy brute force solution to this problem, but the optimal solution is linear. The code here is written in vanilla PHP. If you’re interviewing at a company like Google, Facebook, Apple, etc., this is exactly the kind of coding interview question you might have to face.
https://gist.github.com/jacksongabbard/3ff1869e2e833609f1d30a75a06bd8f5.js