LeetCode --- 1108. Defanging an IP Address 解题报告
Posted 杨鑫newlfe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 1108. Defanging an IP Address 解题报告相关的知识,希望对你有一定的参考价值。
Given a valid (IPv4) IP address
, return a defanged version of that IP address.
A defanged IP address replaces every period "."
with "[.]"
.
Example 1:
Input: address = "1.1.1.1" Output: "1[.]1[.]1[.]1"
Example 2:
Input: address = "255.100.50.0" Output: "255[.]100[.]50[.]0"
Constraints:
- The given
address
is a valid IPv4 address.
所有代码均可在Github中找到:
# -*- coding:utf-8 -*-
__author__ = \'yangxin_ryan\'
"""
Solutions:
根据题意说明替换字符串中的 . 为 [.] 即可。
"""
class DefangingAnIPAddress(o
以上是关于LeetCode --- 1108. Defanging an IP Address 解题报告的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode 1108. Defanging an IP Address
LeetCode 1108 IP地址无效化[暴力] HERODING的LeetCode之路
Python描述 LeetCode 1108. IP 地址无效化
Python描述 LeetCode 1108. IP 地址无效化