title: Remainder 7 Large Numbers
signature: function remainder7LargeNumbers(num: string): number {
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;
    }
question_info.test_list: [{"idx": 0, "outputs": 6, "inputs": {"num": "K"}}, {"idx": 1, "outputs": 3, "inputs": {"num": "850076"}}, {"idx": 2, "outputs": 6, "inputs": {"num": "00111"}}, {"idx": 3, "outputs": 5, "inputs": {"num": "X"}}, {"idx": 4, "outputs": 1, "inputs": {"num": "1"}}, {"idx": 5, "outputs": 1, "inputs": {"num": "10010001100"}}, {"idx": 6, "outputs": 0, "inputs": {"num": " pgPeLz"}}, {"idx": 7, "outputs": 3, "inputs": {"num": "53212456821275"}}, {"idx": 8, "outputs": 3, "inputs": {"num": "101"}}, {"idx": 9, "outputs": 3, "inputs": {"num": "V"}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(num: string, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(num),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("K", 6);
    console.log(`TEST-0...${result}`);
  
    result = driver("850076", 3);
    console.log(`TEST-1...${result}`);
  
    result = driver("00111", 6);
    console.log(`TEST-2...${result}`);
  
    result = driver("X", 5);
    console.log(`TEST-3...${result}`);
  
    result = driver("1", 1);
    console.log(`TEST-4...${result}`);
  
    result = driver("10010001100", 1);
    console.log(`TEST-5...${result}`);
  
    result = driver(" pgPeLz", 0);
    console.log(`TEST-6...${result}`);
  
    result = driver("53212456821275", 3);
    console.log(`TEST-7...${result}`);
  
    result = driver("101", 3);
    console.log(`TEST-8...${result}`);
  
    result = driver("V", 3);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: remainder7LargeNumbers
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js