title: Square Root Of An Integer
signature: class Solution {
  
      public Integer squareRootOfAnInteger(Integer x) {
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;
  }
question_info.extension: java
question_info.entry_fn_name: squareRootOfAnInteger
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 9, "inputs": {"x": 89}}, {"idx": 1, "outputs": 3, "inputs": {"x": 11}}, {"idx": 2, "outputs": 3, "inputs": {"x": 14}}, {"idx": 3, "outputs": 9, "inputs": {"x": 92}}, {"idx": 4, "outputs": 8, "inputs": {"x": 76}}, {"idx": 5, "outputs": 7, "inputs": {"x": 63}}, {"idx": 6, "outputs": 7, "inputs": {"x": 51}}, {"idx": 7, "outputs": 4, "inputs": {"x": 16}}, {"idx": 8, "outputs": 9, "inputs": {"x": 83}}, {"idx": 9, "outputs": 8, "inputs": {"x": 66}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer x, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(x,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(89, 9);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(11, 3);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(14, 3);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(92, 9);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(76, 8);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(63, 7);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(51, 7);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(16, 4);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(83, 9);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(66, 8);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer x, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(x),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: java __FILENAME__