Insert one value anywhere in an array to minimize the sum of squared consecutive differences.
Unlock detailed company stats for this questionUpgrade
Given an array, the cost is the sum of (curr - prev)^2 over consecutive elements, 0-indexed starting from index 1. You get one move: insert any value anywhere in the array to minimize the cost after that move.
Community answers
No answers contributed by the community yet.
Related questions
Partition Array Into Two Arrays to Minimize Sum Difference.Find the length of the longest consecutive sequence in an array.Related courses

Course

Course
Course
