The coding question have nothing to do with data structure or algorithm, coding is short and extremely easy and no improvement needed(brute force). However, the background is complicated, lots of question needed to be asked before any coding is done, otherwise you will be doomed as I did.