HTMLify

LeetCode - Valid Perfect Square - Go
Views: 4 | Author: abh
func isPerfectSquare(num int) bool {
	n := 1
	for {
		s := n * n
		if s == num {
			return true
		}
		if s > num {
			break
		}
		n++
	}
	return false
}

Comments