We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 99036bc commit 84bc377Copy full SHA for 84bc377
src/q/mod.rs
@@ -651,6 +651,7 @@ mod q1846;
651
mod q1877;
652
mod q1893;
653
mod q1894;
654
+mod q2022;
655
mod q5818;
656
657
pub struct Solution;
src/q/q2022.rs
@@ -0,0 +1,21 @@
1
+use crate::q::Solution;
2
+
3
+#[allow(unused)]
4
+impl Solution {
5
+ pub fn construct2_d_array(original: Vec<i32>, m: i32, n: i32) -> Vec<Vec<i32>> {
6
+ // 方法1
7
+ // 先检查以下m * n 是不是符合条件
8
+ // 然后直接处理即可
9
+ let l = original.len();
10
+ let m = m as usize;
11
+ let n = n as usize;
12
+ if m * n != l { return vec![]; }
13
+ let mut ans = vec![vec![0; n as usize]; m as usize];
14
+ for i in 0..m {
15
+ for j in 0..n {
16
+ ans[i][j] = original[i * n + j];
17
+ }
18
19
+ ans
20
21
+}
src/q/q273.rs
@@ -6,7 +6,7 @@ impl Solution {
// 方法1
// 3位算一组,然后每组里面计算百十个,然后外面得到十亿,百万,千
// 每组里面又分为了20以内(因为英文20以内是单个单词),20-100,以及100以上
- // AC 0ms 2mb
+ // AC 0ms 2mb 601/601
let singles = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"];
let teens = ["Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"];
let tens = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"];
@@ -40,7 +40,7 @@ impl Solution {
40
let mut i = 3;
41
let mut unit = 1000000000;
42
let mut num = num;
43
- while i < 4 && i >= 0{
+ while i < 4 {
44
let mut cur_num = num / unit;
45
if cur_num != 0 {
46
num -= cur_num * unit;
src/q/q846.rs
@@ -14,7 +14,6 @@ impl Solution {
let n = hand.len();
let mut hand = hand;
hand.sort_unstable();
- Ï
let mut freq = HashMap::new();
for i in 0..n {
*freq.entry(hand[i]).or_insert(0) += 1;
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments