title: Integer Positive Value Positive Negative Value Array 1
signature: def integerPositiveValuePositiveNegativeValueArray1(arr: List[Int], n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Double , expected: Double): Boolean = {
      (actual - expected).abs < 1e-09
  }
  
  def driver(arr: List[Int], n: Int, expected: Double): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        List(49, 98), 1, 
        49.0    
      )}")   
  
  
      println(s"TEST-1...${driver(
        List(82, 66, -68, 24, -10), 2, 
        74.0    
      )}")   
  
  
      println(s"TEST-2...${driver(
        List(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), 8, 
        0.125    
      )}")   
  
  
      println(s"TEST-3...${driver(
        List(56, 3, 18, 5, 20, 56, 47, 29, 60, 98, 60, 40, 42, 2, 54, 56, 91, 8, 93, 14, 31, 27, 61, 49, 23, 12, 71), 25, 
        41.72    
      )}")   
  
  
      println(s"TEST-4...${driver(
        List(-94, -94, -92, -86, -50, -48, -6, 8, 28, 40, 44, 58, 62, 72, 94), 12, 
        -146.0    
      )}")   
  
  
      println(s"TEST-5...${driver(
        List(0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1), 36, 
        0.5833333333333334    
      )}")   
  
  
      println(s"TEST-6...${driver(
        List(16, 56, 56), 1, 
        16.0    
      )}")   
  
  
      println(s"TEST-7...${driver(
        List(74, -90, -92, 30, -18, 66, -66, 22), 5, 
        -96.0    
      )}")   
  
  
      println(s"TEST-8...${driver(
        List(0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 7, 
        0.5714285714285714    
      )}")   
  
  
      println(s"TEST-9...${driver(
        List(21, 64, 82, 78, 30, 34, 35), 5, 
        55.0    
      )}")   
  
  }
  
source_py: def integer_positive_value_positive_negative_value_array_1(arr, n):
      neg = 0
      pos = 0
      sum = 0
      for i in range(0, n):
          sum += arr[i]
          if (arr[i] < 0):
              neg += 1
          else:
              pos += 1
      return (sum / abs((neg - pos)))
source_cpp: int integer_positive_value_positive_negative_value_array_1(vector<int> arr, int n) {
    int neg = 0, pos = 0;
    int sum = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      sum += arr [ i ];
      if ( arr [ i ] < 0 ) neg ++;
      else pos ++;
    }
    return ( sum / abs ( neg - pos ) );
  }