We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Zig Zag Sequence
- Discussions
Zig Zag Sequence
Zig Zag Sequence
Sort by
recency
|
1058 Discussions
|
Please Login in order to post a comment
In python:
Wrong Answer
Input (stdin)
Your Output (stdout)
Expected Output
This is a garbage challenge. First, the Python code I'm supposed to modify is horrible, as if it were written by a first semester compsci student. Granted, most Python programmers are cavemen, but this starter solution was truly gross.
After fixing the three off-by-one situations, my output is exactly what the sample solution output shows (and matches the requirements). But it says the answer is wrong. And it fails every test (which I can't see). Utter waste of time.
You have to make 3 character changes. more than that it will fail. This is what i did and it worked after that
I have made 3 changes of the code using Python 3, and I got the same results as expected results, still it said Wrong answer.
anyone knows why?
`What is the problem?
//C++void findZigZagSequence(vector < int > a, int n){
sort(a.begin(), a.end());
int mid = (n + 1)/2;
int st = mid - 1;
int ed = n - 1;
while(st <= ed){
swap(a[st], a[ed]);
st = st + 1;
ed = ed - 1;
}
for(int i = 0; i < n; i++){
if(i > 0) cout << " ";
cout << a[i];
}
cout << endl;
} `
running failed: compiler Message Wrong Answer
Input (stdin)
1
7
1 2 3 4 5 6 7
Your Output (stdout)
1 2 3 7 6 5 4
Expected Output
1 2 3 7 6 5 4