Amihai007

Recursion - Min_In_Array

Sep 30th, 2020 (edited)
605
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public static int MinInArray (int [] arr, int length)
  2.         {
  3.             int previous = 0;
  4.             if (length == 1 || length == 0) return arr[0];
  5.             previous = MinInArray(arr.Skip(1).ToArray(), arr.Length - 1);
  6.             if (previous > arr[0]) return arr[0];
  7.             else return previous;
  8.         }
RAW Paste Data