title: Square Root Of An Integer
signature: function squareRootOfAnInteger(x) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(x, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(x),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(89, 9);
    console.log(`TEST-0...${result}`);
  
    result = driver(11, 3);
    console.log(`TEST-1...${result}`);
  
    result = driver(14, 3);
    console.log(`TEST-2...${result}`);
  
    result = driver(92, 9);
    console.log(`TEST-3...${result}`);
  
    result = driver(76, 8);
    console.log(`TEST-4...${result}`);
  
    result = driver(63, 7);
    console.log(`TEST-5...${result}`);
  
    result = driver(51, 7);
    console.log(`TEST-6...${result}`);
  
    result = driver(16, 4);
    console.log(`TEST-7...${result}`);
  
    result = driver(83, 9);
    console.log(`TEST-8...${result}`);
  
    result = driver(66, 8);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def square_root_of_an_integer(x):
      if ((x == 0) or (x == 1)):
          return x
      i = 1
      result = 1
      while (result <= x):
          i += 1
          result = (i * i)
      return (i - 1)
source_cpp: int square_root_of_an_integer(int x) {
    if ( x == 0 || x == 1 ) return x;
    int i = 1, result = 1;
    while ( result <= x ) {
      i ++;
      result = i * i;
    }
    return i - 1;
  }