aboutsummaryrefslogtreecommitdiff
path: root/other/daily_temps.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/daily_temps.rs
parent694ad5ed71edcb1deccab54b72d706b779918276 (diff)
downloadleetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz
leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/daily_temps.rs')
-rw-r--r--other/daily_temps.rs28
1 files changed, 0 insertions, 28 deletions
diff --git a/other/daily_temps.rs b/other/daily_temps.rs
deleted file mode 100644
index 63b1f2b..0000000
--- a/other/daily_temps.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-struct Solution;
-
-impl Solution {
- pub fn daily_temperatures(temperatures: Vec<i32>) -> Vec<i32> {
- let n = temperatures.len();
- let mut ans: Vec<i32> = vec![0; n];
- let mut stk: Vec<usize> = Vec::new();
- for i in 0..n {
- while stk.last().map_or(false, |&v| { temperatures[v] < temperatures[i]}) {
- match stk.pop() {
- None => break,
- Some(idx) => ans[idx] = (i - idx) as i32
- }
- }
- stk.push(i);
- }
- ans
- }
-}
-
-fn main() {
- let t1 = vec![73,74,75,71,69,72,76,73];
- let t2 = vec![30,40,50,60];
- let t3 = vec![30,60,90];
- println!("{:?}", Solution::daily_temperatures(t1));
- println!("{:?}", Solution::daily_temperatures(t2));
- println!("{:?}", Solution::daily_temperatures(t3));
-}