Netskope interview question

two algorithms to resolve, related to data structures