TSMC interview question

some array and hash map manipulation