The cost of an array is the sum of squared differences of neighbors. Insert one integer anywhere to make the cost as small as possible.
The cost of an array is the sum of squared differences of neighbors. Insert one integer anywhere to make the cost as small as possible.
Unlock the full question, the code runner with test cases, and reference solution
One-time unlock. Yours forever.
Or get a for every question, unlimited code runs and AI mock interviews.
Be the first to discuss this question
Approaches, follow-up questions and how the interview went. Unlock the question to read and join the discussion.