Created
July 14, 2017 15:32
-
-
Save MichaelaIvanova/e422c0f4bcdad85a738295ef99a8434d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static int solution(int[] A) | |
| { | |
| var maxDepth = int.MaxValue; | |
| var counter = 0; | |
| for (int i = 1; i < A.Length - 1; i++) | |
| { | |
| var current = A[i]; | |
| var previous = A[i - 1]; | |
| var next = A[i + 1]; | |
| if (previous > current && current <= next) | |
| { | |
| if (current < maxDepth) | |
| { | |
| maxDepth = current; | |
| } | |
| } | |
| } | |
| return maxDepth; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment