Unfortunately that’s might not be convincing enough for interviewers who will be expecting a more clever solution.
@rashi174 The Question clearly says solve in O(n+m) and sorting is O(nlogn). Try something clever using 2 pointers.
very nice, is python backend implement sorted by quick sort?
otherwise this solution is o(nlogn)
while the prior make it easy to solve in o(n)
What is the difference between