Skip to content
Solution for recruitment task
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
DeepestDitch.py
README.md
tests.py

README.md

DeepestDitch

Solution for job interview task

Task description

Given an array of integers, find the deepest ditch. 10, 8, 5, 6, 8, 4, 2, 6, 7

10-5 =5

8-5=3

So the depth is min(5, 3) == 3

8-2=6

7-2=5

So the depth in min (6, 5) ==5 The depth of the array is max (3, 5) = 5

Example 2: 10, 8, 12, Depth = 2

Solution complexity

  • Time complexity is linear
  • Memory complexity is const
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.