Array parity sorting of Huawei machine test questions

Message from the person:
Prepare for an interview with Huawei’s outsourcing Deco, and record some interview questions; for
the pitfalls submitted by Niuke.com’s code, you can take a look at the first question below. The local compilation of ide passed, but Niuke.com’s life and death failed. Submit the code prompt: Returns non-zero. The cause analysis
  query shows that when the code with a non-zero result exits, it does not exit with a normal 0, but a non-zero state, that is, the code is wrong, and it is puzzling. Why? When writing a function, if you encounter a specific condition and return directly, the code behind the return will not be executed. I saw a C++ code. Netizens reported that return will be replaced by print by Niuke.com’s shell submission box, which means Will rearrange it for you. At this time, there will be a problem with return, and the code after return will continue to execute.
Therefore, I personally suggest that you do not write methods when writing code, just write directly inside the main method.
 

 

Huawei computer-based test introduction:

Three medium-difficulty questions, with a total score of 400 points, the first two questions are 100 points, the last one is 200 points, and the time limit for each question is 1S (conventional algorithms can’t solve it, you can use violent methods)

The computer-based test score is calculated according to the proportion of the number of passing questions (if you can’t solve the last question, you can write the results of the boundary conditions, etc.)

The computer-based test lasts 2.5 hours. If the goal is to sprint the highest score of the computer-based test, the time for the first two questions will be 40 minutes, and the last question will be 70 minutes (the usual practice can be based on the 40-minute time limit)

The score line of the computer-based test is different according to the recruiting target colleges and non-target colleges

Guess you like

Origin blog.csdn.net/qq_38735017/article/details/130649393