title: Square Root Of An Integer
signature: squareRootOfAnInteger(x) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(x, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(x), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          89, 
          9)
      }");
  
      print("TEST-1...${driver(
          11, 
          3)
      }");
  
      print("TEST-2...${driver(
          14, 
          3)
      }");
  
      print("TEST-3...${driver(
          92, 
          9)
      }");
  
      print("TEST-4...${driver(
          76, 
          8)
      }");
  
      print("TEST-5...${driver(
          63, 
          7)
      }");
  
      print("TEST-6...${driver(
          51, 
          7)
      }");
  
      print("TEST-7...${driver(
          16, 
          4)
      }");
  
      print("TEST-8...${driver(
          83, 
          9)
      }");
  
      print("TEST-9...${driver(
          66, 
          8)
      }");
  
      return 0;
  }
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;
  }