fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. // your code goes here
  8. int outp = FindMin(new int[] {3, 0, 3, 3});
  9. Console.WriteLine(outp);
  10. }
  11.  
  12. public static int FindMin(int[] nums) {
  13. int low = 0, high = nums.Length - 1;
  14. while (low < high) {
  15.  
  16. int mid = low + (high - low)/2;
  17. if (nums[low] <= nums[mid]) {
  18. low = mid + 1;
  19. }
  20. else high = mid;
  21. }
  22. return nums[low];
  23. }
  24. }
Success #stdin #stdout 0.01s 131776KB
stdin
Standard input is empty
stdout
0