Interviewers almost always ask "what is the time and space complexity?" after you code. Answer with the worst case for time, the extra memory your solution allocates for space, and say which line causes each.
Count how many times the innermost work runs. Two nested loops over the input are O(n^2) even when the inner loop starts at i + 1, because the sum n + (n - 1) + ... + 1 is about n^2 / 2. A sort is O(n log n) and usually dominates a linear scan after it. A hash set lookup is O(1) on average, but the set itself is O(n) space.
Watch for hidden costs. Building a string with + in a loop copies everything built so far each time in Java and JavaScript. Slicing a list copies it. Binary search on a million items needs only about 20 steps, because each step halves what is left.
Count how often the innermost line runs; constants and lower terms drop out.