Salesforce Interview Question

Leetcode med on DSA, was asked on stack and graph