aboutsummaryrefslogtreecommitdiff
path: root/other/perfect_squares.rs
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2025-06-27 12:23:02 -0600
committerJack Sangdahl <[email protected]>2025-06-27 12:23:02 -0600
commita96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch)
treee2a2b3f49f9fb741be81415266ac93e74cff42ec /other/perfect_squares.rs
parent694ad5ed71edcb1deccab54b72d706b779918276 (diff)
downloadleetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz
leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/perfect_squares.rs')
-rw-r--r--other/perfect_squares.rs21
1 files changed, 0 insertions, 21 deletions
diff --git a/other/perfect_squares.rs b/other/perfect_squares.rs
deleted file mode 100644
index 3887e40..0000000
--- a/other/perfect_squares.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-use std::cmp::min;
-struct Solution;
-
-impl Solution {
- pub fn num_squares(n: i32) -> i32 {
- let mut dp: Vec<i32> = vec![std::i32::MAX; n as usize + 1];
- dp[0] = 0;
- for i in 1..(n as usize + 1) {
- let mut j: usize = 1;
- while j * j <= i {
- dp[i] = min(dp[i], dp[i - j * j] + 1);
- j += 1;
- }
- }
- dp[n as usize]
- }
-}
-
-fn main() {
- print!("{}", Solution::num_squares(12));
-}