KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
For a given array of integers, find the maximum distance between 2 points (i and j) that have higher values than any element between them. Example: values: 0 10 8 9 6 7 4 10 0 index : 0 1 2 3 4 5 6 7 8 for the values above the solution is i=1, j=7, but if the value of index 7 is 9 instead of 10 the solution is i=3, j=7 if the value of index 7 is 7 instead of 10 the solution is i=5, j=7 I can't see a solution in O(n) ... anyone ?
Tags (comma-separated)
Save Edits
Cancel