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 upAdded 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. |
Added a cpp file for Floyd Algorithm for cycle detection Description of Change
Checklist
Notes: