Minimize Deviation in Array — CaffeCode