{"size": 355, "ext": "js", "max_stars_repo_path": "69 Sqrt(x)/index.js", "max_stars_repo_name": "Clovin/LeetCode", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "69 Sqrt(x)/index.js", "max_issues_repo_name": "Clovin/LeetCode", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "69 Sqrt(x)/index.js", "max_forks_repo_name": "Clovin/LeetCode", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 15.4347826087, "max_line_length": 41, "alphanum_fraction": 0.5042253521}
/**
 * Created by Clovin on 26/01/2018.
 */
/**
 * @param {number} x
 * @return {number}
 */
let temp = [0, 1, 4]

var mySqrt = function (x) {
  for (let i = 0; i < temp.length; i++) {
    if (temp[i] > x) {
      return i - 1
    }
  }

  let index = temp.length
  do {
    temp[index] = index * index
  } while (temp[index++] <= x)

  return index - 2
}