TSMC Interview Question

some array and hash map manipulation