当前位置:网站首页>力扣解法汇总1108-IP 地址无效化
力扣解法汇总1108-IP 地址无效化
2022-07-22 08:55: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("\\.", "\\[\\.\\]");
}
}
边栏推荐
- 按结构体某一元素排序的小程序(fishing_3)
- prosody相关概念了解。xmpp,jabber,bosh等
- [exception] generate guid and datetime, import test data to the database
- Design of miner type identification mechanism based on reputation management model
- 力扣解法汇总729-我的日程安排表 I
- Qt|编辑框的使用总结
- 力扣解法汇总731-我的日程安排表 II
- "Review of software engineering in Wuhan University of technology" Chapter III software requirements
- "Review of software engineering in Wuhan University of technology" Chapter 7 | software testing
- 「武汉理工大学 软件工程复习」第三章 | 软件需求
猜你喜欢
QT笔记——QJson
"Review of software engineering in Wuhan University of technology" Chapter 2 | software process model
Fabric.js 控制元素层级
QT notes - unpolish() and polish() of QT dynamic attributes
【10点公开课】:云视频会议系统私有化实践
"Review of software engineering in Wuhan University of technology" Chapter III software requirements
[bug] datetime format failed
QT笔记—— VS一个项目生成多个exe文件
Thread learning notes
"Review of software engineering in Wuhan University of technology" Chapter 5 | software architecture
随机推荐
关于scrollTo滚动offsetTop到顶部的距离的bug找了两个小时
Le mot de passe MySQL est correct, mais une erreur de démarrage n'a pas été signalée pour créer des connexions initiales de pool. Accès refusé pour l'utilisateur 'root' @ 'localhost
es6赋值解构
Fabric.js 居中元素
数据湖(十八):Flink与Iceberg整合SQL API操作
2021-10-18 burn bare board program with EOP
【Rust】为什么我建议你学一下 Rust | Rust 初探
Gbase8s database minus operator
互斥锁和信号量
visual studio 调试快捷键
小程序实现列表和详情页
C语言结构体初始化的四种方法
「武汉理工大学 软件工程复习」第六章 | 编码规范
女嘉賓報名
fcntl函数
请教下,oracle-cdc是不是不支持检查点,当实时采集过程中任务挂了到重启这段时间的数据变化是不
力扣解法汇总676-实现一个魔法字典
Research on vulnerability identification technology for project version differences
GeoWebCache发布ArcGIS切片数据
Gbase8s database set constraints statement