Thanks for the clear explanations and the easy examples. I think it is a good introductory course and it gives a good starting point to move further to more sophisticated topics and applications.
@consensualcode97502 жыл бұрын
Thanks for the question summary/explanation in the beginning. Question would running two range based for loops be a suboptimal solution or the same thing? vector ans {}; for(auto ii : nums) { ans.push_back(ii); } for(auto ii : nums) { ans.push_back(ii); } return ans; New to C++, really appreciate the videos 👍
@CodeclipsWithAbhishek2 жыл бұрын
Running two loops will perform 2*N operations (N is number of elements in array). Which is O(N) in terms of time complexity. 1. Yes there could be little more optimal solution if elements are appended to input array only. Which can be done in N operations. But in terms of time complexity order it is still O(N).