title: Remainder 7 Large Numbers
signature: def remainder7LargeNumbers(num: String) = {
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(num: String, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(num),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        "K", 
        6    
      )}")   
  
  
      println(s"TEST-1...${driver(
        "850076", 
        3    
      )}")   
  
  
      println(s"TEST-2...${driver(
        "00111", 
        6    
      )}")   
  
  
      println(s"TEST-3...${driver(
        "X", 
        5    
      )}")   
  
  
      println(s"TEST-4...${driver(
        "1", 
        1    
      )}")   
  
  
      println(s"TEST-5...${driver(
        "10010001100", 
        1    
      )}")   
  
  
      println(s"TEST-6...${driver(
        " pgPeLz", 
        0    
      )}")   
  
  
      println(s"TEST-7...${driver(
        "53212456821275", 
        3    
      )}")   
  
  
      println(s"TEST-8...${driver(
        "101", 
        3    
      )}")   
  
  
      println(s"TEST-9...${driver(
        "V", 
        3    
      )}")   
  
  }
  
source_py: def remainder_7_large_numbers(num):
      series = [1, 3, 2, (- 1), (- 3), (- 2)]
      series_index = 0
      result = 0
      for i in range((len(num) - 1), (- 1), (- 1)):
          digit = (ord(num[i]) - 48)
          result += (digit * series[series_index])
          series_index = ((series_index + 1) % 6)
          result %= 7
      if (result < 0):
          result = ((result + 7) % 7)
      return result
source_cpp: int remainder_7_large_numbers(string num) {
    int series [ ] = {
      1, 3, 2, - 1, - 3, - 2 };
      int series_index = 0;
      int result = 0;
      for ( int i = num . size ( ) - 1;
      i >= 0;
      i -- ) {
        int digit = num [ i ] - '0';
        result += digit * series [ series_index ];
        series_index = ( series_index + 1 ) % 6;
        result %= 7;
      }
      if ( result < 0 ) result = ( result + 7 ) % 7;
      return result;
    }