File: root - text - article - 2020 - 02 - generate-all-ip-addresses.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 290 Views, 23090 Search Bots | 99 Words
| Browse | Archive
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 290 Views, 23090 Search Bots | 99 Words
| Browse | Archive
i, here's your problem today. This problem was recently asked by Microsoft:
An IP Address is in the format of A.B.C.D, where A, B, C, D are all integers between 0 to 255.
Given a string of numbers, return the possible IP addresses you can make with that string by splitting into 4 parts of A, B, C, D.
Keep in mind that integers can't start with a 0! (Except for 0)
Example:
Input: 1592551013
Output: ['159.255.101.3', '159.255.10.13']
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 290 Views, 23090 Search Bots | 99 Words An IP Address is in the format of A.B.C.D, where A, B, C, D are all integers between 0 to 255.
Given a string of numbers, return the possible IP addresses you can make with that string by splitting into 4 parts of A, B, C, D.
Keep in mind that integers can't start with a 0! (Except for 0)
Example:
Input: 1592551013
Output: ['159.255.101.3', '159.255.10.13']
def ip_addresses(s, ip_parts=[]):
# Fill this in.
print ip_addresses('1592551013')
# ['159.255.101.3', '159.255.10.13']
Related Articles
- Sorting a list with 3 unique numbers
- Daily Interview Problem:Create a balanced binary search tree
- Binary Tree Level with Minimum Sum
- Daily Interview Problem: 3 Sum
- Daily Interview Problem: Reverse Integer
- [Daily Problem] Validate Balanced Parentheses
- Daily Interview Problem: Validate Binary Search Tree
- New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
- Spreadsheet Columns
- Skip the readings, focus on problems. And use all the hints!
©2006~2024 SteakOverCooked - 0.01208 Seconds(s) - 1625.368 KB/s - 14 Online Memory: 492.98 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 !