Frage im Vorstellungsgespräch bei NVIDIA

Given an array A , find the maximum difference between an element in the array and the elements before it.

Antwort im Vorstellungsgespräch

Anonym

8. Sept. 2024

Traverse the array while maintaining two variables for each element: - The minimum value encountered so far (initialized to the first element). - The maximum difference observed between the current element and the minimum value.