Optimal Blue Interview Question

Find the maximum difference between two numbers in a given array.

Interview Answer

Anonymous

Nov 11, 2019

You’d run through the array from the 0th node to the nth node while storing the largest and smallest numbers in int variables. It’s easy then to calculate the difference: largest - smallest

1