Meta interview question

Motion Search logic