The author of this blog works with CSDN
Tank_in_the_street
The author is the same author, reprint the article need to indicate the source, thank you for your cooperation.

LeetCode’s question 7 was fairly easy to solve, but somehow the pass rate was only 36%… Let’s look at the problem first

In fact, this problem as long as the first check whether the input number exceeds the range, if there is, it will return 0, if not, it will return the inverted number, my code implementation is as follows:

Then I tried the code with 80ms running time in the answer and found that it was only 4ms faster than me. I didn’t even know how leetCode counted the time…