Tesla interview question

Several code questions ripped straight out of leetcode/hackerrank