Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add minimum_moves_to_equal_array_elements_ii#34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
0xmountaintop wants to merge95 commits intomaster
base:master
Choose a base branch
Loading
fromdev
Draft
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
95 commits
Select commitHold shift + click to select a range
554d66f
init single-number-iii
0xmountaintopJul 19, 2019
9c2ef2c
update
0xmountaintopJul 19, 2019
f956209
init
0xmountaintopJul 19, 2019
0e188cc
init sol for single_number_iii
0xmountaintopJul 20, 2019
ce474e2
foreach
0xmountaintopJul 20, 2019
38bfbb9
add more
0xmountaintopJul 20, 2019
28ca1b7
init sol2
0xmountaintopJul 20, 2019
cfc6242
add
0xmountaintopJul 20, 2019
14fed54
clean
0xmountaintopJul 20, 2019
7178f9d
clean
0xmountaintopJul 20, 2019
785b682
Merge remote-tracking branch 'origin/master' into dev
0xmountaintopJul 20, 2019
7389e34
init missing_number
0xmountaintopJul 20, 2019
810d3bd
add
0xmountaintopJul 20, 2019
076b0cc
add more
0xmountaintopJul 20, 2019
e289b51
add missing_number
0xmountaintopJul 20, 2019
a60b390
add mroe
0xmountaintopJul 20, 2019
972cd52
add sol4
0xmountaintopJul 20, 2019
1baf60f
add sol3
0xmountaintopJul 20, 2019
db42760
udpate readme
0xmountaintopJul 20, 2019
e7ea802
init maximum_product_of_word_lengths
0xmountaintopJul 20, 2019
6c30f64
update readme
0xmountaintopJul 20, 2019
2286772
merge
0xmountaintopJul 20, 2019
987dcda
minor
0xmountaintopJul 20, 2019
b1a1712
update
0xmountaintopJul 20, 2019
be4bafb
fix readme
0xmountaintopJul 20, 2019
eb63411
init max_product
0xmountaintopJul 20, 2019
21fd9ba
update
0xmountaintopJul 20, 2019
7235506
wip
0xmountaintopJul 23, 2019
78390b4
from &str
0xmountaintopJul 23, 2019
bcdaf0d
minor
0xmountaintopJul 23, 2019
ddad596
imnor
0xmountaintopJul 23, 2019
f9def88
minor
0xmountaintopJul 23, 2019
e84f3b7
wip
0xmountaintopJul 23, 2019
004780b
minor
0xmountaintopJul 23, 2019
14cd70f
fix
0xmountaintopJul 23, 2019
81ea210
???
0xmountaintopJul 23, 2019
203a2bb
fix
0xmountaintopJul 23, 2019
b475650
add
0xmountaintopJul 23, 2019
451b9ed
update
0xmountaintopJul 23, 2019
8322ca4
clean
0xmountaintopJul 24, 2019
5898100
merge
0xmountaintopJul 24, 2019
cf3c97a
fix
0xmountaintopJul 24, 2019
2564bb9
merge
0xmountaintopJul 24, 2019
a8080b3
merge
0xmountaintopJul 24, 2019
96ed4a4
init for power_of_four
0xmountaintopJul 24, 2019
4febd4d
update is_power_of_four
0xmountaintopJul 24, 2019
f499b80
add sol1
0xmountaintopJul 24, 2019
1b03a30
add sol2
0xmountaintopJul 24, 2019
2b1c407
clean
0xmountaintopJul 24, 2019
338a516
mark sol
0xmountaintopJul 24, 2019
81589bd
init get_sum
0xmountaintopJul 24, 2019
badc27b
Merge remote-tracking branch 'origin/master' into dev
0xmountaintopJul 24, 2019
2364c69
fix readme
0xmountaintopJul 24, 2019
9fe0f8e
add get_sum sol1
0xmountaintopJul 24, 2019
61d04ac
wip
0xmountaintopJul 24, 2019
4bc6684
refactor
ChrisLinnJul 24, 2019
c3c31e3
refactor
ChrisLinnJul 24, 2019
cdcb3c7
add
ChrisLinnJul 24, 2019
f16dfb1
add find_the_difference
0xmountaintopJul 25, 2019
2a5ac09
Merge remote-tracking branch 'origin/master' into dev
0xmountaintopJul 25, 2019
2eb45aa
add
0xmountaintopJul 25, 2019
0e87d6e
draft
0xmountaintopJul 25, 2019
cef2b1e
init utf_8_validation
ChrisLinnJul 26, 2019
946feab
add valid_utf8
ChrisLinnJul 26, 2019
bd522ea
add utf_8_validation
0xmountaintopJul 31, 2019
59437e2
cargo fmt
0xmountaintopJul 31, 2019
49efa24
merge
0xmountaintopJul 31, 2019
7a2a1b5
Merge remote-tracking branch 'origin/master' into dev
0xmountaintopJul 31, 2019
31d6d39
add sol3
0xmountaintopJul 31, 2019
56ebeea
clean up
0xmountaintopJul 31, 2019
a753940
fix
0xmountaintopJul 31, 2019
7753c9d
fix
0xmountaintopJul 31, 2019
61a62cf
init test_read_binary_watch
ChrisLinnJul 31, 2019
0f17beb
add testcases
ChrisLinnJul 31, 2019
ab8a0d7
Merge remote-tracking branch 'origin/master' into dev
ChrisLinnJul 31, 2019
bdb75f5
minor
0xmountaintopAug 1, 2019
905afc7
minor
0xmountaintopAug 1, 2019
357b3c6
clean up
0xmountaintopAug 1, 2019
674c4e8
wip
0xmountaintopAug 1, 2019
06e1ec9
fix
0xmountaintopAug 1, 2019
ddac1ec
fix
0xmountaintopAug 1, 2019
6c98617
Merge remote-tracking branch 'origin/master' into dev
0xmountaintopAug 1, 2019
63c8b96
init maximum_xor_of_two_numbers_in_an_array
0xmountaintopAug 1, 2019
fecae2e
add
ChrisLinnAug 1, 2019
39587a1
add
ChrisLinnAug 1, 2019
c1fc403
fix
ChrisLinnAug 1, 2019
fbcbd6e
fix
ChrisLinnAug 1, 2019
8fde83c
init hamming_distance
0xmountaintopAug 2, 2019
8a134b0
add
0xmountaintopAug 2, 2019
018cd5c
fix
0xmountaintopAug 2, 2019
98d860b
add 2
0xmountaintopAug 2, 2019
468e52d
fix
0xmountaintopAug 2, 2019
0dc748d
merge
0xmountaintopAug 2, 2019
54b5767
Merge remote-tracking branch 'origin/master' into dev
0xmountaintopAug 2, 2019
4c10ad8
add
0xmountaintopAug 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,14 +72,14 @@ cargo test
0411 | [~~Minimum Unique Word Abbreviation~~](https://leetcode.com/problems/minimum-unique-word-abbreviation/) | [C++](https://github.com/kamyu104/LeetCode-Solutions/blob/master/C++/minimum-unique-word-abbreviation.cpp) [Python](https://github.com/kamyu104/LeetCode-Solutions/blob/master/Python/minimum-unique-word-abbreviation.py) | _O(2^n)_ | _O(n)_ | Hard | 🔒 |
0421 | [Maximum XOR of Two Numbers in an Array](https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/) | [C++](https://github.com/kamyu104/LeetCode-Solutions/blob/master/C++/maximum-xor-of-two-numbers-in-an-array.cpp) [Python](https://github.com/kamyu104/LeetCode-Solutions/blob/master/Python/maximum-xor-of-two-numbers-in-an-array.py) <br>------</br> [Rust](./kamyu104/src/maximum_xor_of_two_numbers_in_an_array.rs) | _O(n)_ | _O(n)_ | Medium ||
0461 | [Hamming Distance](https://leetcode.com/problems/hamming-distance/) | [C++](https://github.com/kamyu104/LeetCode-Solutions/blob/master/C++/hamming-distance.cpp) [Python](https://github.com/kamyu104/LeetCode-Solutions/blob/master/Python/hamming-distance.py) <br>------</br> [Rust](./kamyu104/src/hamming_distance.rs) | _O(1)_ | _O(1)_ | Easy ||
0462 | [Minimum Moves to Equal Array Elements II](https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/) | [C++](https://github.com/kamyu104/LeetCode-Solutions/blob/master/C++/minimum-moves-to-equal-array-elements-ii.cpp) [Python](https://github.com/kamyu104/LeetCode-Solutions/blob/master/Python/minimum-moves-to-equal-array-elements-ii.py) <br>------</br> [Rust](./kamyu104/src/minimum_moves_to_equal_array_elements_ii.rs) | _O(n)_ on average | _O(1)_ | Medium ||

<!--

=======

<!--

0462 | [Minimum Moves to Equal Array Elements II](https://leetcode.com/problems/minimum-moves-to-equal-array-elements-ii/) | [C++](./C++/minimum-moves-to-equal-array-elements-ii.cpp) [Python](./Python/minimum-moves-to-equal-array-elements-ii.py) | _O(n)_ on average | _O(1)_ | Medium ||
0477 | [Total Hamming Distance](https://leetcode.com/problems/total-hamming-distance/) | [C++](./C++/total-hamming-distance.cpp) [Python](./Python/total-hamming-distance.py) | _O(n)_ | _O(1)_ | Medium ||
0645 | [Set Mismatch](https://leetcode.com/problems/set-mismatch/) | [C++](./C++/set-mismatch.cpp) [Python](./Python/set-mismatch.py) | _O(n)_ | _O(1)_ | Easy ||
0693 | [Binary Number with Alternating Bits](https://leetcode.com/problems/binary-number-with-alternating-bits/) | [C++](./C++/binary-number-with-alternating-bits.cpp) [Python](./Python/binary-number-with-alternating-bits.py) | _O(1)_ | _O(1)_ | Easy ||
Expand Down
1 change: 1 addition & 0 deletionskamyu104/src/main.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@ mod find_the_difference;
mod hamming_distance;
mod maximum_product_of_word_lengths;
mod maximum_xor_of_two_numbers_in_an_array;
mod minimum_moves_to_equal_array_elements_ii;
mod missing_number;
mod number_of_1_bits;
mod power_of_four;
Expand Down
20 changes: 20 additions & 0 deletionskamyu104/src/minimum_moves_to_equal_array_elements_ii.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
// Time: O(n) on average
// Space: O(1)

// Quick select solution.
pub struct Solution {}
impl Solution {
pub fn min_moves2(nums: Vec<i32>) -> i32 {
2
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_min_moves2() {
assert_eq!(Solution::min_moves2(vec![1, 2, 3]), 2);
}
}

[8]ページ先頭

©2009-2025 Movatter.jp