1182. Shortest Distance to Target Color
ArrayBinary SearchDynamic Programming
Hints
Hint 1
Greedy solution is too slow because of the limits.
Hint 2
Can you solve this problem offline by doing some pre-processing?
Hint 3
Calculate the answers for all indexes moving to their left and to their right.
Preparing judge…