Valid Perfect Square

Given a positive integer num, return true if an integer exists whose square equals num; otherwise return false. Do not use a built-in square-root function.

Given a positive integer `num`, return `true` if an integer exists whose square equals `num`; otherwise return `false`. Do not use a built-in square-root function.

- `1 <= num <= 10^9`

Example 1: input num = 16; output true. 4 × 4 equals 16.

Example 2: input num = 14; output false. 3² is 9 and 4² is 16, so no integer square equals 14.

Category: Binary Search. Topic: binary-search. Difficulty: Easy. Patterns: binary-search-on-answer.