Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 716 Bytes

File metadata and controls

38 lines (26 loc) · 716 Bytes

Square Root

In mathematics, a square root of a number x is a number y such that y2 = x; in other words, a number y whose square (the result of multiplying the number by itself, or y ⋅ y) is x.

Calculate the floor of the square root of the input.

input

  • type: uint256
  • range: unlimited

output

  • type: uint256

sample solution

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.5;

library SampleSolution {
    function sqrt(uint256 x) external view returns (uint256 y) {
        // TO BE IMPLEMENTED 
        return 0;
    }
}

examples

input output
0 0
1 1
2 1
12345 111