https://svsnippets0.medium.com/google-swe-intern-interview-problem-solution-with-explainations-f3af97b65a64