Skip to content

Commit cc1748b

Browse files
committed
update readme
1 parent ad15fcd commit cc1748b

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

Algorithms/0002.add_two_numbers/add_two_numbers.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1-
use super::list_node::ListNode;
21
use std::cmp;
2+
// Definition for singly-linked list.
3+
#[derive(PartialEq, Eq, Clone, Debug)]
4+
pub struct ListNode {
5+
pub val: i32,
6+
pub next: Option<Box<ListNode>>
7+
}
8+
9+
impl ListNode {
10+
#[inline]
11+
fn new(val: i32) -> Self {
12+
ListNode {
13+
next: None,
14+
val
15+
}
16+
}
17+
}
318

419
impl Solution {
520
pub fn add_two_numbers(l1: Option<Box<ListNode>>, l2: Option<Box<ListNode>>) -> Option<Box<ListNode>> {
6-
let mut results: Option<Box<ListNode>>;
721
let mut i1 = l1;
822
let mut i2 = l2;
923
let mut overflow_value = 0;

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
# leetcode-rust
2-
leetcode in rust lang.
32

43
[![LeetCode 排名](https://img.shields.io/badge/cruoru-1-blue.svg)](https://leetcode.com/cruoru/)
54
[![codecov](https://codecov.io/gh/ruoru/leetcode-rust/branch/master/graph/badge.svg)](https://codecov.io/gh/ruoru/leetcode-rust)
65
[![Build Status](https://api.travis-ci.org/ruoru/leetcode-rust.svg?branch=master)](https://www.travis-ci.org/ruoru/leetcode-rust)
76

8-
7+
leetcode in rust lang.
98

109
## Schedule
1110

11+
~~立个flag一年刷完leetcode~~
1212

13+
## Start
14+
1. click `Order` column link to leetcode websit, paste `Topic` column link code in it and run.
15+
2. `xxx_test.rs` is main, `xxx.rs` is solution.
1316

1417
## Answer
1518

1619
|Order|Topic|Difficult|Runtime|Memory|Collection|
1720
|:-:|:-|:-:|:-:|:-:|---|
18-
|1|[Two Sum](./Algorithms/0001.two_sum)|Easy|0 ms|1.6 MB||
19-
|2|[Add Two Numbers](./Algorithms/0002.add_two_numbers)|Medium||||
20-
|3|[Longest Substring Without Repeating Characters](./Algorithms/0003.longest_substring_without_repeating_characters)|Medium||||
21-
|4|[Median of Two Sorted Arrays](./Algorithms/0004.median_of_two_sorted_arrays)|Hard|0 ms|2.1 MB||
22-
|13|[Roman to Integer](./Algorithms/0013.roman_to_integer)|Easy|0 ms|1.9 MB||
23-
|70|[Climbing Stairs](./Algorithms/0070.climbing_stairs)|Easy|0 ms|2.1 MB||
24-
|88|[Merge Sorted Array](./Algorithms/0088.merge_sorted_array)|Easy|0 ms|2.2 MB||
25-
|118|[Pascal's Triangle](./Algorithms/0118.pascals_triangle)|Easy|0 ms|2.1 MB||
21+
|[1](https://leetcode.com/problems/two-sum/)|[Two Sum](./Algorithms/0001.two_sum)|Easy|0 ms|1.6 MB||
22+
|[2](https://leetcode.com/problems/add-two-numbers/)|[Add Two Numbers](./Algorithms/0002.add_two_numbers)|Medium||||
23+
|[3](https://leetcode.com/problems/longest-substring-without-repeating-characters/)|[Longest Substring Without Repeating Characters](./Algorithms/0003.longest_substring_without_repeating_characters)|Medium||||
24+
|[4](https://leetcode.com/problems/median-of-two-sorted-arrays/)|[Median of Two Sorted Arrays](./Algorithms/0004.median_of_two_sorted_arrays)|Hard|0 ms|2.1 MB||
25+
|[13](https://leetcode.com/problems/roman-to-integer/)|[Roman to Integer](./Algorithms/0013.roman_to_integer)|Easy|0 ms|1.9 MB||
26+
|[70]()|[Climbing Stairs](./Algorithms/0070.climbing_stairs)|Easy|0 ms|2.1 MB||
27+
|[88]()|[Merge Sorted Array](./Algorithms/0088.merge_sorted_array)|Easy|0 ms|2.2 MB||
28+
|[118]()|[Pascal's Triangle](./Algorithms/0118.pascals_triangle)|Easy|0 ms|2.1 MB||

0 commit comments

Comments
 (0)