Angi Interview Question

What is the time complexity of your implementation?