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, 20415 Search Bots | 70 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 801 Views, 20415 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, 20415 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
- Consecutive Ones
- Daily Interview Problem: Distribute Bonuses
- YES!!
- How to Play WAV music under DOS?
- Daily Interview Problem: Spiral Traversal of Grid
- Daily Interview Puzzle: Minimum Size Subarray Sum
- [Daily Problem] Move Zeros
- Daily Interview Question: Edit Distance
- Daily Interview Problem: Min Range Needed to Sort
- Algorithm Interview: Determine If Linked List is Palindrome
©2006~2024 SteakOverCooked - 0.00842 Seconds(s) - 2190.482 KB/s - 23 Online Memory: 491.63 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="noindex, 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 !