You are viewing a single comment's thread. Return to all comments →
You shouldn't use arrays like that. In fact, a is initialized with the first value of n what is garbage, something like 39281233, because is initialized in compile time not execution time, for dinamic size you must use pointers and the keyword new or vector from std.
Why does my comment have negative votes?
cin >> n;
part of the code worked for me. Should this be tested for my hackerrank and marked as incorrect when used to commplete this challenge?