Company: Visa_5sep
Difficulty: medium
Simulate CD Command Problem Description Your task is to implement a simulation of a change directory command. This command changes the current working directory to the specified one. The initial working directory is root i.e. / . You are given a list of cd commands. There are multiple options for command arguments. cd / - changes the working directory to the root directory. cd . - stays in the current directory. cd .. - moves the working directory one level up. In the root directory, cd .. does nothing. cd <subdirectory> - moves to the specified subdirectory within the current working directory. <subdirectory> is a string consisting of only lowercase English letters. All specified directories exist. Return the absolute path from the root to the working directory after executing all cd commands in the given order. / should be used as separators. Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(commands.leng