MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / get_chars

Function get_chars

844-backspace-string-compare.rs:2–13  ·  view source on GitHub ↗
(s: String)

Source from the content-addressed store, hash-verified

1pub fn backspace_compare(s: String, t: String) -> bool {
2 fn get_chars(s: String) -> Vec<char> {
3 let s_chars: Vec<char> = s.chars().collect();
4 let mut cs = vec!();
5 for c in s_chars {
6 if c != '#' {
7 cs.push(c);
8 } else {
9 cs.pop();
10 }
11 }
12 cs
13 }
14 get_chars(s) == get_chars(t)
15}
16

Callers 1

backspace_compareFunction · 0.85

Calls 2

pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected