Far across the distance, And spaces, between us 🎵
Functionality
Finds the maximmum right - left, such that list[right] > list[left].
Time Complexity : O(n) (2 traversals)
Space Complexity : O(n) (1 extra list)
How to use
The find_distance function takes a ref to an array or a vector as a paramaeter, and finds the maximum distance of two such elements.
It returns an Option<usize> type as a result, because two such numbers that satisfy the condition might not exist. In that case, it returns None.
Quick Start:
use find_distance;