title: Minimum Perimeter N Blocks
signature: function minimumPerimeterNBlocks(n: number): number {
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 Math.abs(actual - expected) < 1e-09;
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(45, 28.832815729997478);
    console.log(`TEST-0...${result}`);
  
    result = driver(80, 37.77708763999664);
    console.log(`TEST-1...${result}`);
  
    result = driver(54, 29.393876913398138);
    console.log(`TEST-2...${result}`);
  
    result = driver(48, 29.712812921102035);
    console.log(`TEST-3...${result}`);
  
    result = driver(83, 36.4417343165772);
    console.log(`TEST-4...${result}`);
  
    result = driver(68, 32.984845004941285);
    console.log(`TEST-5...${result}`);
  
    result = driver(32, 24.62741699796952);
    console.log(`TEST-6...${result}`);
  
    result = driver(20, 19.88854381999832);
    console.log(`TEST-7...${result}`);
  
    result = driver(68, 32.984845004941285);
    console.log(`TEST-8...${result}`);
  
    result = driver(66, 34.49615361854384);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
source_py: def minimum_perimeter_n_blocks(n):
      l = math.sqrt(n)
      sq = (l * l)
      if (sq == n):
          return (l * 4)
      else:
          row = (n / l)
          perimeter = (2 * (l + row))
          if ((n % l) != 0):
              perimeter += 2
          return perimeter
source_cpp: int minimum_perimeter_n_blocks(int n) {
    int l = sqrt ( n );
    int sq = l * l;
    if ( sq == n ) return l * 4;
    else {
      long long int row = n / l;
      long long int perimeter = 2 * ( l + row );
      if ( n % l != 0 ) perimeter += 2;
      return perimeter;
    }
  }