在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ Given a list of folders, remove all sub-folders in those folders and return in any order the folders after removing. If a folder[i] is located within another folder[j], it is called a sub-folder of it. The format of a path is one or more concatenated strings of the form: / followed by one or more lowercase English letters. For example, /leetcode and /leetcode/problems are valid paths while an empty string and / are not. Example 1: Input: folder = ["/a","/a/b","/c/d","/c/d/e","/c/f"] Input: folder = ["/a","/a/b/c","/a/b/d"] Input: folder = ["/a/b/c","/a/b/d","/a/b/ca"] Constraints: 1 <= folder.length <= 4 * 10^4 你是一位系统管理员,手里有一份文件夹列表 folder,你的任务是要删除该列表中的所有 子文件夹,并以 任意顺序 返回剩下的文件夹。 我们这样定义「子文件夹」: 如果文件夹 folder[i] 位于另一个文件夹 folder[j] 下,那么 folder[i] 就是 folder[j] 的子文件夹。 / 后跟一个或者多个小写英文字母。
示例 1: 输入:folder = ["/a","/a/b","/c/d","/c/d/e","/c/f"] 输入:folder = ["/a","/a/b/c","/a/b/d"] 输入:folder = ["/a/b/c","/a/b/d","/a/b/ca"] 提示: 1 <= folder.length <= 4 * 10^4 |
请发表评论