My LeetCode grinding. Trying to do a problem a day.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

1234567891011121314151617
  1. pub fn is_perfect_square(num: i32) -> bool {
  2. for x in 1..46341 {
  3. let res = (x as i32).pow(2);
  4. if res > num {
  5. return false;
  6. }
  7. if res == num {
  8. return true;
  9. }
  10. }
  11. return false;
  12. }
  13. fn main() {
  14. println!("Expected: true");
  15. println!("Got: {}", is_perfect_square(16));
  16. }