Posts

Showing posts from January, 2018

Math

Start on Jan 28th 2018  End on Feb 10th 2018 (1) Conversion To/From Integers 7.  Reverse Integer  (N)     int reverse(int x) {         long r = 0;         while (x) {             int remainder = x % 10;             r = r * 10 + remainder;             x /= 10;         }               return (r >= INT_MIN && r <= INT_MAX) ? r : 0;     } 8.   String to Integer (atoi)  (N) The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value. The string can contain additional characters after those that f...