Sequence with sum K and minimum sum of absolute differences between consecutive elements | Function to return the minimized sum ; If k is divisible by n then the answer will be 0 ; Else the answer will be 1 ; Driver code
function minimum_sum ( n , k ) { if ( k % n == 0 ) return 0 ; return 1 ; } let n = 3 , k = 56 ; document . write ( minimum_sum ( n , k ) ) ;