Skip to content

Commit

Permalink
add problem add_two_numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
SKTT1Ryze committed Oct 11, 2023
1 parent 612c95d commit 9079465
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions leetcode/src/problems.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod add_two_numbers;
pub mod two_sum;

#[allow(dead_code)]
Expand Down
28 changes: 28 additions & 0 deletions leetcode/src/problems/add_two_numbers.rs
Original file line number Diff line number Diff line change
@@ -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<String> {
["link list".into()].into()
}
}

0 comments on commit 9079465

Please sign in to comment.