#115

Unix Command Call Counter

MEDIUMHash TablePYTHON

Problem Description

Given a list of Unix commands that includes both direct commands (like `cp`, `ls`, `mv`) and alias references (like `$1`, `$4`), count how many times each base command is ultimately called. Alias references point to other commands in the list by their 1-based index, and aliases can chain (e.g., `$4` → `$1` → `cp`). Return a dictionary mapping each base command to its total call count after resolving all aliases.

Topics

hash tablegraph

Asked at Companies

databricks

Solve This Problem

Sign up to access the interactive code editor, run test cases, view the editorial, and get AI-powered feedback on your solution.

Start Solving →