title: Sum Two Large Numbers
signature: class Solution {
  
      public String sumTwoLargeNumbers(String str1, String str2) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String str1, String str2, String expected){
          try{
              Driver driver = new Driver();
              if (driver.run(str1, str2,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("VkfzrPG", "rKZ", "44527855");
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("0526110506447", "903", "0526110507350");
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("011010010", "110100000", "121110010");
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("sPAwZACc ", "liYMsojPiinOV", "66153436372942");
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("3", "611", "614");
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("0101", "01110101011", "01110101112");
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("VTtNu", "Wsmc", "469530");
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("2317170", "898421173423", "898423490593");
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("111111000010", "01100001110111", "01211112110121");
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("Ktt", "CTbbVX wGBkE", "2315420138859");
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String str1, String str2, String expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(str1, str2),expected);
      }
      
      public boolean validateSolution(String actual, String expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def sum_two_large_numbers(str1, str2):
      if (len(str1) > len(str2)):
          t = str1
          str1 = str2
          str2 = t
      str = ''
      n1 = len(str1)
      n2 = len(str2)
      str1 = str1[::(- 1)]
      str2 = str2[::(- 1)]
      carry = 0
      for i in range(n1):
          sum = ((ord(str1[i]) - 48) + ((ord(str2[i]) - 48) + carry))
          str += chr(((sum % 10) + 48))
          carry = int((sum / 10))
      for i in range(n1, n2):
          sum = ((ord(str2[i]) - 48) + carry)
          str += chr(((sum % 10) + 48))
          carry = int((sum / 10))
      if carry:
          str += chr((carry + 48))
      str = str[::(- 1)]
      return str
source_cpp: string sum_two_large_numbers(string str1, string str2) {
    if ( str1 . length ( ) > str2 . length ( ) ) swap ( str1, str2 );
    string str = "";
    int n1 = str1 . length ( ), n2 = str2 . length ( );
    reverse ( str1 . begin ( ), str1 . end ( ) );
    reverse ( str2 . begin ( ), str2 . end ( ) );
    int carry = 0;
    for ( int i = 0;
    i < n1;
    i ++ ) {
      int sum = ( ( str1 [ i ] - '0' ) + ( str2 [ i ] - '0' ) + carry );
      str . push_back ( sum % 10 + '0' );
      carry = sum / 10;
    }
    for ( int i = n1;
    i < n2;
    i ++ ) {
      int sum = ( ( str2 [ i ] - '0' ) + carry );
      str . push_back ( sum % 10 + '0' );
      carry = sum / 10;
    }
    if ( carry ) str . push_back ( carry + '0' );
    reverse ( str . begin ( ), str . end ( ) );
    return str;
  }