Question d’entretien chez DoorDash

Find the number in an array that is nearest to target. An dynamic programming problem with memorization.