diff --git a/leetcode/src/problems.rs b/leetcode/src/problems.rs index c27ebd3..f4d6577 100644 --- a/leetcode/src/problems.rs +++ b/leetcode/src/problems.rs @@ -1,3 +1,4 @@ +pub mod add_two_numbers; pub mod two_sum; #[allow(dead_code)] diff --git a/leetcode/src/problems/add_two_numbers.rs b/leetcode/src/problems/add_two_numbers.rs new file mode 100644 index 0000000..f6a97c3 --- /dev/null +++ b/leetcode/src/problems/add_two_numbers.rs @@ -0,0 +1,28 @@ +use super::{Difficulty, Problem, Topic}; + +pub struct AddTwoNumbers; + +impl Problem for AddTwoNumbers { + fn id(&self) -> usize { + 2 + } + fn difficulty(&self) -> Difficulty { + Difficulty::Medium + } + fn topic(&self) -> Topic { + Topic::Algorithms + } + fn title(&self) -> String { + "Add Two Numbers".into() + } + fn description(&self) -> String { + r#"You are given two non-empty linked lists representing two non-negative integers. +The digits are stored in reverse order, and each of their nodes contains a single digit. +Add the two numbers and return the sum as a linked list. +You may assume the two numbers do not contain any leading zero, except the number 0 itself."# + .into() + } + fn labels(&self) -> Vec { + ["link list".into()].into() + } +}