File: root - text - article - 2019 - 12 - reverse-integer.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 801 Views, 20406 Search Bots | 70 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 801 Views, 20406 Search Bots | 70 Words
| Browse | Archive
Hi, here's your problem today. This problem was recently asked by LinkedIn:
Write a function that reverses the digits a 32-bit signed integer, x. Assume that the environment can only store integers within the 32-bit signed integer range, [-2^31, 2^31 - 1]. The function returns 0 when the reversed integer overflows.
Example:
Input: 123
Output: 321
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 801 Views, 20406 Search Bots | 70 Words Write a function that reverses the digits a 32-bit signed integer, x. Assume that the environment can only store integers within the 32-bit signed integer range, [-2^31, 2^31 - 1]. The function returns 0 when the reversed integer overflows.
Example:
Input: 123
Output: 321
class Solution:
def reverse(self, x):
# Fill this in.
print(Solution().reverse(123))
# 321
print(Solution().reverse(2**31))
# 0
Related Articles
- Daily Interview Problem: Circle of Chained Words
- Consecutive Ones
- Daily Interview Problem: Sort Colors
- Daily Interview Problem: Merge Overlapping Intervals
- Progess made
- A trick for getting good at coding interviews FASTER
- Fibonacci coding
- Two-Sum
- Algorithm Interview: Lowest Common Ancestor of 2 Nodes in Binary Tree
- Daily Interview Problem: Given two arrays, write a function to compute their intersection.
©2006~2024 SteakOverCooked - 0.00664 Seconds(s) - 2917.78 KB/s - 24 Online Memory: 493.47 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="index, follow">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !