The Question is how can the code has mistakes when it runs correctly in Qt with the same array as input as in example.
Because you didn´t replay anything that could solve the problem
Hi everyone. When I run the code in my IDE(Qt) it shows the correct output, but when I run the code here, I get different output. Does someone encountered similar problem?
This comment is hidden because it contains spoiler information about the solution
int findOdd(const std::vector<int>& numbers) {
int arrayLength = numbers.size(); for(int i = 0; i < (arrayLength - 1); i++) { int counter = 0; for(int j = 0; j <= arrayLength; j++) { if (numbers[i] == numbers[j]) { counter++; } } if(counter % 2) { return numbers[i]; } } return numbers[arrayLength - 1];
}
When I test this code in Qt with sample arrays it returns the correct value, but when I execute it here it doesn't. Any ideas why.
Loading collection data...
The Question is how can the code has mistakes when it runs correctly in Qt with the same array as input as in example.
Because you didn´t replay anything that could solve the problem
Hi everyone. When I run the code in my IDE(Qt) it shows the correct output, but when I run the code here, I get different output. Does someone encountered similar problem?
This comment is hidden because it contains spoiler information about the solution
int findOdd(const std::vector<int>& numbers) {
}
When I test this code in Qt with sample arrays it returns the correct value, but when I execute it here it doesn't. Any ideas why.
This comment is hidden because it contains spoiler information about the solution