Algorithm · Weride · Hard
Problem You are given two arrays, heights and costs. The value heights[i] represents the height of block i, while costs[i] is the price of raising that block by one unit. Each block may be increased by an integer amount without an upper limit. Determine the lowest possible total cost needed to ensure that every pair of neighboring blocks has different final heights. Implement the following function: The function returns the minimum total adjustment cost. Example Input:…
Checking your access…