Company: Tredence
Difficulty: medium
Valid File Path Aggregator Problem Description You are building a system that processes a large list of file path entries submitted by users. Each entry is a string that is supposed to represent an absolute file path in a UNIX-like system. Your task is to count the total number of unique valid file paths from the given input list. A valid file path must satisfy all of the following: It starts with a / (root directory). It contains only valid path components separated by /. Each component: Contains only alphanumeric characters (a-z, A-Z, 0-9), underscores (_), hyphens (-), or dots (.). Is not empty (i.e., no double slashes // anywhere in the path). The path must not contain any . or .. components (i.e., no current directory or parent directory references). The path must not contain spaces or other invalid characters. Additionally, trailing slashes at the end of the path should be ignored when determining uniqueness (i.e., /home/user/docs and /home/user/docs/ are considered the same path