| Action | Tickets Earned |
|---|---|
Complete Daily Challenge | +1 |
10-Day Streak | +10 |
20-Day Streak | +20 |
30-Day Streak | +30 |
LinkedIn post with #30DaysofCode Everyday (and tag Educative) | +2 per post |
Most-Liked Post Overall | +20 |
Top of Leaderboard | +50 |
Leaderboard: 2nd place | +30 |
Leaderboard: 3rd place | +20 |
Given an absolute path for a Unix-style file system (always beginning with '/'), transform it into its simplified canonical form.
The Unix-style file system follows these rules:
A single period '.' represents the current directory.
A double period '..' represents the parent directory.
Multiple consecutive slashes (e.g., '//' or '///') are treated as a single slash '/'.
Any sequence of periods that does not match the above rules is treated as a valid directory or file name (e.g., '...' and '....' are valid names).
The resulting canonical path must satisfy the following:
It must begin with a single slash '/'.
Directories must be separated by exactly one slash '/'.
It must not end with a trailing slash '/', unless it is the root directory.
It must not contain any '.' or '..' components used to denote current or parent directories.
Return the simplified canonical path.
Constraints:
path.length
path consists of English letters, digits, period '.', slash '/', or underscore '_'
path is a valid absolute Unix path
| Action | Tickets Earned |
|---|---|
Complete Daily Challenge | +1 |
10-Day Streak | +10 |
20-Day Streak | +20 |
30-Day Streak | +30 |
LinkedIn post with #30DaysofCode Everyday (and tag Educative) | +2 per post |
Most-Liked Post Overall | +20 |
Top of Leaderboard | +50 |
Leaderboard: 2nd place | +30 |
Leaderboard: 3rd place | +20 |
Given an absolute path for a Unix-style file system (always beginning with '/'), transform it into its simplified canonical form.
The Unix-style file system follows these rules:
A single period '.' represents the current directory.
A double period '..' represents the parent directory.
Multiple consecutive slashes (e.g., '//' or '///') are treated as a single slash '/'.
Any sequence of periods that does not match the above rules is treated as a valid directory or file name (e.g., '...' and '....' are valid names).
The resulting canonical path must satisfy the following:
It must begin with a single slash '/'.
Directories must be separated by exactly one slash '/'.
It must not end with a trailing slash '/', unless it is the root directory.
It must not contain any '.' or '..' components used to denote current or parent directories.
Return the simplified canonical path.
Constraints:
path.length
path consists of English letters, digits, period '.', slash '/', or underscore '_'
path is a valid absolute Unix path