title: N Th Number Whose Sum Of Digits Is Ten 2
signature: function n_th_number_whose_sum_of_digits_is_ten_2(n)
source_py: def n_th_number_whose_sum_of_digits_is_ten_2(n):
      nthElement = (19 + ((n - 1) * 9))
      outliersCount = (int(math.log10(nthElement)) - 1)
      nthElement += (9 * outliersCount)
      return nthElement
source_cpp: int n_th_number_whose_sum_of_digits_is_ten_2(int n) {
    int nthElement = 19 + ( n - 1 ) * 9;
    int outliersCount = ( int ) log10 ( nthElement ) - 1;
    nthElement += 9 * outliersCount;
    return nthElement;
  }
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(n, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(n) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(68, 631)
      print(string.format("TEST-0...%s",result))
  
      result = driver(70, 649)
      print(string.format("TEST-1...%s",result))
  
      result = driver(69, 640)
      print(string.format("TEST-2...%s",result))
  
      result = driver(93, 856)
      print(string.format("TEST-3...%s",result))
  
      result = driver(99, 910)
      print(string.format("TEST-4...%s",result))
  
      result = driver(44, 415)
      print(string.format("TEST-5...%s",result))
  
      result = driver(91, 838)
      print(string.format("TEST-6...%s",result))
  
      result = driver(8, 82)
      print(string.format("TEST-7...%s",result))
  
      result = driver(83, 766)
      print(string.format("TEST-8...%s",result))
  
      result = driver(51, 478)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 631, "inputs": {"n": 68}}, {"idx": 1, "outputs": 649, "inputs": {"n": 70}}, {"idx": 2, "outputs": 640, "inputs": {"n": 69}}, {"idx": 3, "outputs": 856, "inputs": {"n": 93}}, {"idx": 4, "outputs": 910, "inputs": {"n": 99}}, {"idx": 5, "outputs": 415, "inputs": {"n": 44}}, {"idx": 6, "outputs": 838, "inputs": {"n": 91}}, {"idx": 7, "outputs": 82, "inputs": {"n": 8}}, {"idx": 8, "outputs": 766, "inputs": {"n": 83}}, {"idx": 9, "outputs": 478, "inputs": {"n": 51}}]
question_info.extension: lua
question_info.entry_fn_name: n_th_number_whose_sum_of_digits_is_ten_2
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__