code running fine on ide , pls help whats wrong with this logic ???
Importance of time wrong output
@Ajaypandey
In the case when we are changing position i.e. pushing the first element of the first queue to its last , we only need to do ans++ as it is mentioned in the problem that changing requires only one unit of time.
Also you shouldn’t pop the elements from q1 and q2 in this case as there is no reason to .
1 Like
i got it ,thank you bhaiya
@Ajaypandey
Please mark your doubt as Resolved in your Doubts Section if your issue is solved. Or let me know if there’s any further issue with your doubt.