NSC EB1A-140 PP RFE, 请大家支招!!!!# Immigration - 落地生根
y*e
1 楼
我忘了是F家还是G家的了,当时没仔细看大家的讨论,这两天做lintcode,竟然和这题
重逢了,看了半天一点思路也没有,不知有没有大神愿意指点一下,动态方程应该怎么
写?
题目:
Given an integer array, adjust each integers so that the difference of every
adjcent integers are not greater than a given number target.
If the array before adjustment is A, the array after adjustment is B, you
should minimize the sum of |A[i]-B[i]|
例子
Given [1,4,2,3] and target=1, one of the solutions is [2,3,2,3], the
adjustment cost is 2 and it's minimal. Return 2.
我要是面试碰到这题,直接傻眼。。。。
重逢了,看了半天一点思路也没有,不知有没有大神愿意指点一下,动态方程应该怎么
写?
题目:
Given an integer array, adjust each integers so that the difference of every
adjcent integers are not greater than a given number target.
If the array before adjustment is A, the array after adjustment is B, you
should minimize the sum of |A[i]-B[i]|
例子
Given [1,4,2,3] and target=1, one of the solutions is [2,3,2,3], the
adjustment cost is 2 and it's minimal. Return 2.
我要是面试碰到这题,直接傻眼。。。。