Find Maximum Difference

Find Maximum Difference is a coding interview problem from Cisco interviews. Given N and a list of integers, determine the maximum difference between two elements where the larger value appears after the smaller one. Print that difference, or 0 if no valid pair exists. A clear array-based interview question focused on order and difference.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: