diff options
Diffstat (limited to 'next-greater-element-i')
-rw-r--r-- | next-greater-element-i/Cargo.toml | 8 | ||||
-rw-r--r-- | next-greater-element-i/src/main.rs | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/next-greater-element-i/Cargo.toml b/next-greater-element-i/Cargo.toml new file mode 100644 index 0000000..406d4ef --- /dev/null +++ b/next-greater-element-i/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "next-greater-element-i" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/next-greater-element-i/src/main.rs b/next-greater-element-i/src/main.rs new file mode 100644 index 0000000..84ab40c --- /dev/null +++ b/next-greater-element-i/src/main.rs @@ -0,0 +1,17 @@ +fn main() { + println!("Hello, world!"); +} + +struct Solution {} + +impl Solution { + pub fn next_greater_element(nums1: Vec<i32>, nums2: Vec<i32>) -> Vec<i32> { + let mut result = nums1.clone(); + for i in result.iter_mut() { + nums2.iter().position(|&x| x == *i); + } + + + result + } +} |