Pinterest Interview Question

Question related to prefix tries.