bhai thanks for the python solution. there are not much resources available for dsa with python. keep going
@dataenggstudies9 ай бұрын
Sure, I will upload more. Glad it helped.
@lutherlusk29759 ай бұрын
youre writing while inside for , doesnt that incrase the time complexity from n to m * n or something like that ?
@dataenggstudies9 ай бұрын
This solution looks like O(n*m) but it is actually not because we are iterating over the while loop only for the numbers that are 'first' numbers, in other words the numbers that satisfy the condition (if n-1 not in nums:) not for all the numbers. Hence the time complexity is O(n).