Arista Networks Interview Question

Design a trie based solution