Mengxin brush button - number and place

Sequence of questions:

 

Recommended Blogs:

(13 messages) A ​​comprehensive summary of bit operations, it is enough to read this article about bit operations_unique_pursuit's Blog-CSDN Blog_Bit Operations

 

Number and place topic categories:

Bit manipulation of numbers:

invert an integer

  1. stack structure
  2. Convert it to a string, and flip it according to the string method.
  3. Gets the trailing digit of this integer using modulo arithmetic. Take 12345 as an example, first get 5, then get 4, then 3, 2, 1, we can reversely stitch a number in this order, and achieve the reverse effect.

The first and second methods are not as computationally efficient as the third.

Guess you like

Origin blog.csdn.net/ikkkp/article/details/127000502
Recommended