title: Recursive C Program Linearly Search Element Given Array
signature: def recursiveCProgramLinearlySearchElementGivenArray(arr: List[Int], l: Int, r: Int, x: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(arr: List[Int], l: Int, r: Int, x: Int, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, l, r, x),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        List(10, 74, 5), 0, 2, 1, 
        -1    
      )}")   
  
  
      println(s"TEST-1...${driver(
        List(-90, 72, 36, 96, 42, 0, -66, 5), 0, 7, 96, 
        3    
      )}")   
  
  
      println(s"TEST-2...${driver(
        List(0, 5), 0, 1, -1, 
        -1    
      )}")   
  
  
      println(s"TEST-3...${driver(
        List(99, 70, 67, 5), 0, 3, 3, 
        -1    
      )}")   
  
  
      println(s"TEST-4...${driver(
        List(-98, -98, -26, -26, -24, -18, -16, 80, 5), 0, 8, 80, 
        7    
      )}")   
  
  
      println(s"TEST-5...${driver(
        List(1, 1, 1, 1, 0, 1, 5), 0, 6, 1, 
        0    
      )}")   
  
  
      println(s"TEST-6...${driver(
        List(1, 5, 12, 12, 17, 17, 12, 95, 96, 98, 5), 0, 0, 12, 
        -1    
      )}")   
  
  
      println(s"TEST-7...${driver(
        List(50, -70, -30, -54, 6, -10, 70, 84, 5), 0, 8, 27, 
        -1    
      )}")   
  
  
      println(s"TEST-8...${driver(
        List(0, 1, 5), 0, 2, 14, 
        -1    
      )}")   
  
  
      println(s"TEST-9...${driver(
        List(59, 21, 28, 3, 14, 5), 0, 5, 28, 
        2    
      )}")   
  
  }
  
source_py: def recursive_c_program_linearly_search_element_given_array(arr, l, r, x):
      if (r < l):
          return (- 1)
      if (arr[l] == x):
          return l
      if (arr[r] == x):
          return r
      return recursive_c_program_linearly_search_element_given_array(arr, (l + 1), (r - 1), x)
source_cpp: int recursive_c_program_linearly_search_element_given_array(vector<int> arr, int l, int r, int x) {
    if ( r < l ) return - 1;
    if ( arr [ l ] == x ) return l;
    if ( arr [ r ] == x ) return r;
    return recursive_c_program_linearly_search_element_given_array ( arr, l + 1, r - 1, x );
  }