Tap here to switch tabs
Problem
Submissions

Problem: Remove Sub-Folders from the Filesystem

med
30 min
Try to solve the Remove Sub-Folders from the Filesystem problem.

Statement

Given an array of string paths folder, remove all subfolders and return the remaining folders in any order.

A folder path folder[i] is considered a subfolder of folder[j] if folder[i] starts with folder[j] followed by '/'. For instance, "/a/b" is a subfolder of "/a", whereas "/ab" is not a subfolder of "/a".

Constraints:

  • 1≤1 \leq folder.length ≤4imes104\leq 4 imes 10^4

  • 2≤2 \leq folder[i].length ≤100\leq 100

  • folder[i] contains only lowercase letters and '/'.

  • folder[i] always starts with the character '/'.

  • Each folder name is unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Remove Sub-Folders from the Filesystem

med
30 min
Try to solve the Remove Sub-Folders from the Filesystem problem.

Statement

Given an array of string paths folder, remove all subfolders and return the remaining folders in any order.

A folder path folder[i] is considered a subfolder of folder[j] if folder[i] starts with folder[j] followed by '/'. For instance, "/a/b" is a subfolder of "/a", whereas "/ab" is not a subfolder of "/a".

Constraints:

  • 1≤1 \leq folder.length ≤4imes104\leq 4 imes 10^4

  • 2≤2 \leq folder[i].length ≤100\leq 100

  • folder[i] contains only lowercase letters and '/'.

  • folder[i] always starts with the character '/'.

  • Each folder name is unique.