Skip to content

Commit cabb599

Browse files
committed
find unique characterセットアップ
1 parent 40df340 commit cabb599

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/find_unique_character.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
pub struct Solution;
2+
impl Solution {
3+
pub fn first_uniq_char(s: String) -> i32 {
4+
return 0;
5+
}
6+
}
7+
8+
#[cfg(test)]
9+
mod tests {
10+
use super::*;
11+
12+
#[test]
13+
fn test_1() {
14+
assert_eq!(Solution::first_uniq_char("leetcode".to_string()), 0);
15+
}
16+
17+
#[test]
18+
fn test_2() {
19+
assert_eq!(Solution::first_uniq_char("loveleetcode".to_string()), 2);
20+
}
21+
22+
#[test]
23+
fn test_3() {
24+
assert_eq!(Solution::first_uniq_char("aabb".to_string()), -1);
25+
}
26+
}

src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
mod romen_to_integer;
1+
mod find_unique_character;
22
fn main() {
3-
let romen = "MCMXCIV".to_string();
4-
let result = romen_to_integer::Solution::roman_to_int(romen);
3+
let result = find_unique_character::Solution::first_uniq_char("leetcode".to_string());
54
println!("{:?}", result);
65
}

0 commit comments

Comments
 (0)