title: Squared Triangular Number Sum Cubes
signature: function squaredTriangularNumberSumCubes(s: number): number {
source_py: def squared_triangular_number_sum_cubes(s):
      _sum = 0
      n = 1
      while (_sum < s):
          _sum += ((n * n) * n)
          n += 1
      n -= 1
      if (_sum == s):
          return n
      return (- 1)
source_cpp: int squared_triangular_number_sum_cubes(int s) {
    int sum = 0;
    for ( int n = 1;
    sum < s;
    n ++ ) {
      sum += n * n * n;
      if ( sum == s ) return n;
    }
    return - 1;
  }
question_info.test_list: [{"idx": 0, "outputs": -1, "inputs": {"s": 15}}, {"idx": 1, "outputs": 3, "inputs": {"s": 36}}, {"idx": 2, "outputs": -1, "inputs": {"s": 39}}, {"idx": 3, "outputs": -1, "inputs": {"s": 43}}, {"idx": 4, "outputs": -1, "inputs": {"s": 75}}, {"idx": 5, "outputs": -1, "inputs": {"s": 49}}, {"idx": 6, "outputs": -1, "inputs": {"s": 56}}, {"idx": 7, "outputs": -1, "inputs": {"s": 14}}, {"idx": 8, "outputs": -1, "inputs": {"s": 62}}, {"idx": 9, "outputs": -1, "inputs": {"s": 97}}]
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(s: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(s),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(15, -1);
    console.log(`TEST-0...${result}`);
  
    result = driver(36, 3);
    console.log(`TEST-1...${result}`);
  
    result = driver(39, -1);
    console.log(`TEST-2...${result}`);
  
    result = driver(43, -1);
    console.log(`TEST-3...${result}`);
  
    result = driver(75, -1);
    console.log(`TEST-4...${result}`);
  
    result = driver(49, -1);
    console.log(`TEST-5...${result}`);
  
    result = driver(56, -1);
    console.log(`TEST-6...${result}`);
  
    result = driver(14, -1);
    console.log(`TEST-7...${result}`);
  
    result = driver(62, -1);
    console.log(`TEST-8...${result}`);
  
    result = driver(97, -1);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: squaredTriangularNumberSumCubes
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