Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
added carRefueling.cpp #752
Conversation
@iiitv/project-maintainers please review my PR and let me know if any changes are to be done. Problem Introduction Input Format : The first line contains an integer 𝑑. The second line contains an integer 𝑚. The third line Output Format : Assuming that the distance between the cities is 𝑑 miles, a car can travel at most 𝑚 miles Output Screenshots :
|
@iiitv/project-maintainers Please review my PR and let me know if any changes are to be done. |
Add a new line at end of file and write time complexity of solution. |
Correct the time complexity of code, i think it should be O(n). |
|
||
return 0; | ||
} | ||
//Time Complexity of the implementation : O(n^2) |
ishanksoni
Oct 1, 2020
@darshanhande11 , It doesn't seem the correct time complexity of your implementation, Please analyse the code again :)
@darshanhande11 , It doesn't seem the correct time complexity of your implementation, Please analyse the code again :)
darshanhande11
Oct 1, 2020
•
Author
@ishanksoni Yes sir, the time complexity is O(n), I overlooked the fact that the nested while loop takes a constant amount of time and the outer while loop takes at most n+1 iterations.
@ishanksoni Yes sir, the time complexity is O(n), I overlooked the fact that the nested while loop takes a constant amount of time and the outer while loop takes at most n+1 iterations.
darshanhande11 commentedSep 1, 2020
Fixes #726
By submitting this pull request I confirm I've read and complied with the below declarations.
Added {Algorithm/DS name} [{Language}]
, notUpdate README.md
orAdded new code
.