当前位置:网站首页>LeetCode 1108 IP地址无效化[暴力] HERODING的LeetCode之路
LeetCode 1108 IP地址无效化[暴力] HERODING的LeetCode之路
2022-06-21 16:44:00 【HERODING23】

解题思路:
定义字符串ans,暴力搜索一遍,遇到.就替换,否则直接放入ans的后面,代码如下:
class Solution {
public:
string defangIPaddr(string address) {
string ans;
for(auto& a : address) {
if(a == '.') {
ans += "[.]";
} else {
ans += a;
}
}
return ans;
}
};
边栏推荐
- 国元期货开户可靠吗?新手如何安全开户?
- One trick: let logs help you make decisions through Yanrong SaaS data service platform +elk
- 编写第一个C#应用程序——Hello, C#
- EtherCAT master station based on am4377 controls STM32 slave station
- C语言dll动态链接库
- 服务端socket程序
- 堆栈认知——栈溢出实例(ret2shellcode)
- Mysql常见面试题
- SCAU Software Engineering Fundamentals
- 智慧三农数字王宁:适合初学者的前5日交易秘诀
猜你喜欢

Seventy years of neural network: review and Prospect

Compose programming idea

EtherCAT master station based on am4377 controls STM32 slave station

Stm32f1 and stm32subeide programming example - linear Hall effect sensor driver

POSIX信号量

企业高管收入杂谈

System V IPC与POSIX IPC

Paper notes ACL 2022 unified structure generation for universal information extraction

Stack awareness - stack overflow instance (ret2text)

SQL操作:WITH表达式及其应用
随机推荐
Differences between WCDMA and LTE
直播平台开发,直播各个分类单例设计展示
Seventy years of neural network: review and Prospect
Nacos registry ----- built and used from 0
Stack cognition -- basic use of reverse IDA tools
性能测试---locust的on_start 和 on_stop 方法
Stack awareness - stack overflow instance (ret2libc)
是关于Linux中一步建立yum源缓存问题
Technical architecture of large websites | information encryption technology and key security management
List set to comma concatenated string
服务端socket程序
大型网站技术架构 | 信息加密技术及密匙安全管理
Stack cognition - stack overflow instance (ret2shellcode)
How to perform en45545 fire test for battery shell
Runmeide Healthcare a réussi l'audience d'inscription sur la liste: les pertes devraient augmenter, Huo Yunfei Brothers détenant environ 33%
What is the S3 protocol that we are talking about every day? This article takes you to understand the story behind S3
MySQL 1055 error -this is incompatible with SQL_ mode=only_ full_ group_ By solution
Tcpserver enable multithreading
Runmaide medical passed the listing hearing: it is expected that the loss will increase, with huoyunfei brothers holding about 33%
不是一流大学毕业,却通过自学软件测试,进了阿里年薪初始22K