Max Difference in Array

Given an integer array arr, find the two numbers such that the second number appears after the first one and their difference is as large as possible. Return the maximum difference. If no such pair ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: