Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 547 Bytes

Question_1598.md

File metadata and controls

26 lines (22 loc) · 547 Bytes

LeetCode Records - Question 1598 Crawler Log Folder

Attempt 1: Use a loop

class Solution {
    public int minOperations(String[] logs) {
        int count = 0;

        for (String log : logs) {
            if (log.equals("../")) {
                if (count > 0) {
                    count--;
                }
            } else if (!log.equals("./")) {
                count++;
            }
        }

        return count;
    }
}
  • Runtime: 1 ms (Beats: 99.42%)
  • Memory: 41.90 MB (Beats: 51.62%)