Triplebyte Interview Question

Time complexity of given algorithm