Added Floyd Algorithm for searching for duplicates #1179
Conversation
Could someone please help me why these automated tests are failing even though my code is perfect? |
Yeah, I've gone through that but unable to rectify the error from it as it is showing numerous errors in code despite my code is compiling just perfect. Actually, this is my first PR that's why having some difficulty doing it. Hope you'll help. |
Output: 3 | ||
*/ | ||
#include<bits/stdc++.h> | ||
using namespace std; |
Pardeep009
Oct 9, 2020
•
Contributor
as per repo standards, you cannot use namespaces globally.
using cout, cin etc directly is not allowed, instead use std::cout, std::cin
#include<bits/stdc++.h> | ||
using namespace std; | ||
int findDuplicate(vector<int>& nums) { | ||
int slow=nums[0]; |
Pardeep009
Oct 9, 2020
Contributor
you have declared c style arrays, use std::array, for example see https://github.com/TheAlgorithms/C-Plus-Plus/pull/1085
Pardeep009
Oct 9, 2020
Contributor
bits/stdc++ library is not allowed, as it is Linux specific and it also slows down compilation process. so include only required libraries.
Thanks @Pardeep009 for giving such a detailed step by step solution to my problem, it was a great help. |
Kindly review and update me if any furthur changes are to be made |
Not upto repo standards. |
make sure you must add comments for all functions, what they are going to do, what their parameters are, what will be their return type, also add testing for your code. Refer https://github.com/TheAlgorithms/C-Plus-Plus/pull/1085. |
@Pardeep009 thank you for providing your reviews Note that "prefect" code, as you refer it, is subjective. The repository goals and objectives and standards might be much more higher and stricter. Following the norms can help you become a good programmer as that is one of the objectives of the repo. The code contributed should be such that any layman reading it can learn from the code. |
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Added a cpp file for Floyd Algorithm for cycle detection Description of Change
Checklist
Notes: