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 c141371 commit b15bfb6Copy full SHA for b15bfb6
src/bin/find-the-difference.rs
@@ -0,0 +1,23 @@
1
+fn main() {}
2
+
3
+struct Solution;
4
5
+impl Solution {
6
+ pub fn find_the_difference(s: String, t: String) -> char {
7
+ let mut h = vec![0u8; 26];
8
9
+ for i in s.bytes() {
10
+ h[(i - b'a') as usize] += 1;
11
+ }
12
13
+ for i in t.bytes() {
14
+ if h[(i - b'a') as usize] == 0 {
15
+ return i as char;
16
17
18
+ h[(i - b'a') as usize] -= 1;
19
20
21
+ 'a'
22
23
+}
0 commit comments