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

Function min_operations

1598-crawler-log-folder.rs:1–13  ·  view source on GitHub ↗
(logs: Vec<String>)

Source from the content-addressed store, hash-verified

1pub fn min_operations(logs: Vec<String>) -> i32 {
2 let mut ret = 0;
3 for log in logs {
4 if log.contains("..") {
5 if ret > 0 { ret -= 1 }
6 } else if log.contains(".") {
7 continue
8 } else {
9 ret += 1
10 }
11 }
12 ret
13}
14
15fn main() {
16 let logs: Vec<String> = ["d1/","d2/","../","d21/","./"].iter().map(|e|e.to_string()).collect();

Callers

nothing calls this directly

Calls 1

containsMethod · 0.80

Tested by

no test coverage detected