当前位置:网站首页>力扣解法汇总1108-IP 地址无效化
力扣解法汇总1108-IP 地址无效化
2022-06-21 16:02:00 【失落夏天】
目录链接:
力扣编程题-解法汇总_分享+记录-CSDN博客
GitHub同步刷题项目:
https://github.com/September26/java-algorithms
原题链接:力扣
描述:
给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本。
所谓无效化 IP 地址,其实就是用 "[.]" 代替了每个 "."。
示例 1:
输入:address = "1.1.1.1"
输出:"1[.]1[.]1[.]1"
示例 2:
输入:address = "255.100.50.0"
输出:"255[.]100[.]50[.]0"
提示:
给出的 address 是一个有效的 IPv4 地址
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/defanging-an-ip-address
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
解题思路:
* 解题思路: * 一行代码解决
代码:
public class Solution1108 {
public String defangIPaddr(String address) {
return address.replaceAll("\\.", "\\[\\.\\]");
}
}边栏推荐
- 如何判断DNS解析故障?如何解决DNS解析错误?
- Yaml file details
- 微信小程序开发入门介绍-布局组件
- Online text list batch add line number tool
- 【1108. IP 地址无效化】
- Test log of unittest framework
- Oracle中实现获取指定行内容——Rownum和Row_number()
- Google Earth engine (GEE) - sentinel-1 comprehensively check the difference between automatic landslide monitoring before and after two months (Guatemala as an example)
- 聚焦工业智能化场景,华为云招募合作伙伴,帮助解决转型难题
- 关于印发《北京市共有产权住房管理暂行办法》的通知
猜你喜欢
随机推荐
集成底座方案演示说明
About product operation strategy
我给航母做3D还原:这三处细节,太震撼了…
Google Earth Engine(GEE)——用sentinel-2数据获取获取一个月前归一化植被指数NDVI差异(危地马拉为例)
Characteristics of a good product
The release of autok3s v0.5.0 continues to be simple and friendly
Cisco (35) -- BGP introduction experiment
Disruptor本地线程队列_WorkProcessor异常_FatalExceptionHandler---线程间通信工作笔记004
Elegant request retry using guzzle Middleware
4. construction [LR (1) analysis table (including construction project specification family)]
Overseas new things | software developer "dynaboard" seed round raised US $6.6 million to develop low code platform to connect design, products and developers
[observation] Microsoft's "cloud + end" comprehensive innovation makes hybrid cloud simpler, more flexible and more secure
之前的装机记录
Pytest framework
Postman基本操作
Pingcap was selected as the "voice of customers" of Gartner cloud database in 2022, and won the highest score of "outstanding performer"
机器学习模型监控(Aporia)
Undefined functions or variables [explained in one article] (matlab)
Wise people: three no's, four no's and five no's, the ancient way of dealing with people
重磅丨国内首份呈现数据库发展历程的图鉴正式发布!








