title: Find A Fixed Point In A Given Array
signature: find_a_fixed_point_in_a_given_array <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(8L, 16L, 21L, 26L, 27L, 29L, 34L, 35L, 35L, 37L, 38L, 40L, 48L, 52L, 58L, 59L, 60L, 61L, 63L, 63L, 65L, 66L, 69L, 75L, 79L, 83L, 86L, 88L, 91L, 91L, 96L), 23L, 
          -1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(22L, -70L, 34L, -44L, 84L, 54L, 14L, -88L), 7L, 
          -1L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 31L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(59L, 67L, 70L, 34L, 18L, 22L, 52L, 95L, 11L, 66L, 60L, 24L, 7L, 71L, 52L, 88L, 32L, 52L, 85L, 81L, 32L, 44L, 25L, 51L, 47L, 97L, 81L, 33L, 88L, 38L, 36L, 54L, 80L, 25L, 70L, 27L, 75L, 29L, 94L), 37L, 
          -1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-96L, -96L, -94L, -88L, -88L, -82L, -72L, -72L, -70L, -70L, -66L, -64L, -64L, -62L, -58L, -54L, -46L, -44L, -30L, -26L, -22L, -8L, -6L, -2L, 0L, 26L, 30L, 30L, 34L, 42L, 42L, 48L, 64L, 76L, 90L, 96L), 34L, 
          -1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L), 15L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(2L, 2L, 4L, 7L, 10L, 15L, 16L, 16L, 23L, 24L, 27L, 39L, 42L, 58L, 60L, 64L, 72L, 74L, 78L, 78L, 78L, 80L, 80L, 84L, 85L, 86L, 88L, 88L, 90L, 92L, 93L, 94L, 95L, 96L), 22L, 
          -1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-68L, -48L, 36L, 22L, -80L, -48L, -74L, -14L, 44L, -46L, -76L, 18L, -16L, -36L, -68L, 0L, -30L, -56L, 42L, 92L, 82L, 64L, -18L, -6L, -78L, -86L, 26L, 86L, 36L, -66L, -50L, 18L, -26L, 48L, 8L), 20L, 
          -1L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 23L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(3L, 76L, 99L, 1L, 1L, 29L, 9L, 12L, 57L, 12L, 74L, 22L, 83L, 77L, 39L, 84L, 50L, 60L, 36L, 90L, 88L, 62L, 79L, 58L, 58L, 40L, 44L, 99L, 84L, 63L, 23L, 21L, 16L, 98L, 68L, 8L, 46L), 35L, 
          -1L
      )))
  
  }
  
  main()
source_py: def find_a_fixed_point_in_a_given_array(arr, n):
      for i in range(n):
          if (arr[i] is i):
              return i
      return (- 1)
source_cpp: int find_a_fixed_point_in_a_given_array(vector<int> arr, int n) {
    int i;
    for ( i = 0;
    i < n;
    i ++ ) {
      if ( arr [ i ] == i ) return i;
    }
    return - 1;
  }