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

Function backspace_compare

844-backspace-string-compare.rs:1–15  ·  view source on GitHub ↗
(s: String, t: 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
17fn main() {
18 let s = "ab##".to_string();

Callers

nothing calls this directly

Calls 1

get_charsFunction · 0.85

Tested by

no test coverage detected