Array: max diff updated code