Pergunta de entrevista da empresa DoorDash

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