367. Valid Perfect Square Easy

@problem@discussion
#Math#Binary Search



1/**
2 * [367] Valid Perfect Square
3 *
4 * Given a positive integer num, write a function which returns True if num is a perfect square else False.
5 * Follow up: Do not use any built-in library function such as sqrt.
6 *  
7 * Example 1:
8 * Input: num = 16
9 * Output: true
10 * Example 2:
11 * Input: num = 14
12 * Output: false
13 *  
14 * Constraints:
15 * 
16 * 	1 <= num <= 2^31 - 1
17 * 
18 */
19pub struct Solution {}
20
21// problem: https://leetcode.com/problems/valid-perfect-square/
22// discuss: https://leetcode.com/problems/valid-perfect-square/discuss/?currentPage=1&orderBy=most_votes&query=
23
24// submission codes start here
25
26impl Solution {
27    pub fn is_perfect_square(num: i32) -> bool {
28        false
29    }
30}
31
32// submission codes end
33
34#[cfg(test)]
35mod tests {
36    use super::*;
37
38    #[test]
39    fn test_367() {
40    }
41}
42


Back
© 2025 bowen.ge All Rights Reserved.