Skip to content

Commit 9cedd24

Browse files
author
wuyinjun
committed
新题目
1 parent 9793f90 commit 9cedd24

File tree

1,061 files changed

+1077
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,061 files changed

+1077
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

167. 两数之和 II - 输入有序数组/Rust/Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "Rust"
3+
version = "0.1.0"
4+
authors = ["wuyinjun <[email protected]>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
struct Solution {}
2+
3+
impl Solution {
4+
pub fn two_sum(numbers: Vec<i32>, target: i32) -> Vec<i32> {
5+
let mut left = 0;
6+
let mut right = numbers.len() - 1;
7+
while left < right {
8+
if numbers[left] + numbers[right] == target {
9+
break;
10+
} else if numbers[left] + numbers[right] < target {
11+
left += 1;
12+
} else if numbers[left] + numbers[right] > target {
13+
right -= 1;
14+
}
15+
}
16+
17+
return vec![(left+1) as i32, (right+1) as i32];
18+
}
19+
}
20+
21+
fn main() {
22+
println!("Hello, world!");
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc_fingerprint":12783892854743894208,"outputs":{"1164083562126845933":["rustc 1.44.1 (c7087fe00 2020-06-17)\nbinary: rustc\ncommit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7\ncommit-date: 2020-06-17\nhost: x86_64-apple-darwin\nrelease: 1.44.1\nLLVM version: 9.0\n",""],"4476964694761187371":["___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/admin/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n",""]},"successes":{}}

167. 两数之和 II - 输入有序数组/Rust/target/debug/.cargo-lock

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ac72c51fa2aeb169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":7151530983591731262,"features":"[]","target":7016809546517363022,"profile":14891217944882224483,"path":1036222786711178230,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/Rust-43ac98b9c0dfaa96/dep-bin-Rust-43ac98b9c0dfaa96"}}],"rustflags":[],"metadata":11755119164262387208}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{"message":"struct is never constructed: `Solution`","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":7,"byte_end":15,"line_start":1,"line_end":1,"column_start":8,"column_end":16,"is_primary":true,"text":[{"text":"struct Solution {}","highlight_start":8,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: struct is never constructed: `Solution`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:1:8\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m1\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0mstruct Solution {}\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(dead_code)]` on by default\u001b[0m\n\n"}
2+
{"message":"method is never used: `two_sum`","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":40,"byte_end":98,"line_start":4,"line_end":4,"column_start":5,"column_end":63,"is_primary":true,"text":[{"text":" pub fn two_sum(numbers: Vec<i32>, target: i32) -> Vec<i32> {","highlight_start":5,"highlight_end":63}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: method is never used: `two_sum`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:4:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m4\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m pub fn two_sum(numbers: Vec<i32>, target: i32) -> Vec<i32> {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n"}
3+
{"message":"crate `Rust` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(non_snake_case)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"convert the identifier to snake case: `rust`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: crate `Rust` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(non_snake_case)]` on by default\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: convert the identifier to snake case: `rust`\u001b[0m\n\n"}
4+
{"message":"3 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 3 warnings emitted\u001b[0m\n\n"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{"message":"struct is never constructed: `Solution`","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":7,"byte_end":15,"line_start":1,"line_end":1,"column_start":8,"column_end":16,"is_primary":true,"text":[{"text":"struct Solution {}","highlight_start":8,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(dead_code)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: struct is never constructed: `Solution`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:1:8\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m1\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0mstruct Solution {}\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(dead_code)]` on by default\u001b[0m\n\n"}
2+
{"message":"method is never used: `two_sum`","code":{"code":"dead_code","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":40,"byte_end":98,"line_start":4,"line_end":4,"column_start":5,"column_end":63,"is_primary":true,"text":[{"text":" pub fn two_sum(numbers: Vec<i32>, target: i32) -> Vec<i32> {","highlight_start":5,"highlight_end":63}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: method is never used: `two_sum`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:4:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m4\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m pub fn two_sum(numbers: Vec<i32>, target: i32) -> Vec<i32> {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n"}
3+
{"message":"crate `Rust` should have a snake case name","code":{"code":"non_snake_case","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"`#[warn(non_snake_case)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"convert the identifier to snake case: `rust`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: crate `Rust` should have a snake case name\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `#[warn(non_snake_case)]` on by default\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: convert the identifier to snake case: `rust`\u001b[0m\n\n"}
4+
{"message":"3 warnings emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 3 warnings emitted\u001b[0m\n\n"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9baa4bf72e1b6b5e
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":7151530983591731262,"features":"[]","target":7016809546517363022,"profile":1647870076477133176,"path":1036222786711178230,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/Rust-6cbcabdb055f7426/dep-test-bin-Rust-6cbcabdb055f7426"}}],"rustflags":[],"metadata":11755119164262387208}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/debug/deps/Rust-43ac98b9c0dfaa96.rmeta: src/main.rs
2+
3+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/debug/deps/Rust-43ac98b9c0dfaa96.d: src/main.rs
4+
5+
src/main.rs:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/debug/deps/Rust-6cbcabdb055f7426.rmeta: src/main.rs
2+
3+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/debug/deps/Rust-6cbcabdb055f7426.d: src/main.rs
4+
5+
src/main.rs:

167. 两数之和 II - 输入有序数组/Rust/target/debug/deps/libRust-43ac98b9c0dfaa96.rmeta

Whitespace-only changes.

167. 两数之和 II - 输入有序数组/Rust/target/debug/deps/libRust-6cbcabdb055f7426.rmeta

Whitespace-only changes.

167. 两数之和 II - 输入有序数组/Rust/target/debug/incremental/Rust-1eyeaarntuboj/s-fpgnhre5uh-mfzycs.lock

Whitespace-only changes.

167. 两数之和 II - 输入有序数组/Rust/target/debug/incremental/Rust-2i5xtes4qonqn/s-fpgnhre5ui-1dm70aa.lock

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc_fingerprint":12783892854743894208,"outputs":{"4476964694761187371":["___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/admin/.rustup/toolchains/stable-x86_64-apple-darwin\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_feature=\"ssse3\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n",""],"1164083562126845933":["rustc 1.44.1 (c7087fe00 2020-06-17)\nbinary: rustc\ncommit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7\ncommit-date: 2020-06-17\nhost: x86_64-apple-darwin\nrelease: 1.44.1\nLLVM version: 9.0\n",""]},"successes":{}}

167. 两数之和 II - 输入有序数组/Rust/target/rls/debug/.cargo-lock

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ac72c51fa2aeb169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":7151530983591731262,"features":"[]","target":7016809546517363022,"profile":14891217944882224483,"path":1036222786711178230,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/Rust-43ac98b9c0dfaa96/dep-bin-Rust-43ac98b9c0dfaa96"}}],"rustflags":[],"metadata":11755119164262387208}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file has an mtime of when this was started.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9baa4bf72e1b6b5e
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"rustc":7151530983591731262,"features":"[]","target":7016809546517363022,"profile":1647870076477133176,"path":1036222786711178230,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/Rust-6cbcabdb055f7426/dep-test-bin-Rust-6cbcabdb055f7426"}}],"rustflags":[],"metadata":11755119164262387208}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/rls/debug/deps/Rust-43ac98b9c0dfaa96.rmeta: src/main.rs
2+
3+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/rls/debug/deps/Rust-43ac98b9c0dfaa96.d: src/main.rs
4+
5+
src/main.rs:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/rls/debug/deps/Rust-6cbcabdb055f7426.rmeta: src/main.rs
2+
3+
/Users/admin/Workspaces/Rust/167. 两数之和 II - 输入有序数组/Rust/target/rls/debug/deps/Rust-6cbcabdb055f7426.d: src/main.rs
4+
5+
src/main.rs:

167. 两数之和 II - 输入有序数组/Rust/target/rls/debug/deps/libRust-43ac98b9c0dfaa96.rmeta

Whitespace-only changes.

167. 两数之和 II - 输入有序数组/Rust/target/rls/debug/deps/libRust-6cbcabdb055f7426.rmeta

Whitespace-only changes.

0 commit comments

Comments
 (0)