当前位置:网站首页>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;
}
};
边栏推荐
- About the basic operation of xlrd Library (for beginners)
- 大型网站技术架构 | 应用服务器安全防御
- One trick: let logs help you make decisions through Yanrong SaaS data service platform +elk
- 天天在都在谈的S3协议到底是什么?一文带你了解S3背后的故事
- 堆栈认知——栈溢出实例(ret2shellcode)
- 不是一流大学毕业,却通过自学软件测试,进了阿里年薪初始22K
- PHP的empty,isset和is_null区别
- EtherCAT igh function attempt
- 如何把1000随机分配成10个数
- AttributeError: ‘Book‘ object has no attribute ‘sheet‘
猜你喜欢

鱼佬:电信客户流失预测赛方案!

Analysis of 43 cases of MATLAB neural network: Chapter 27 prediction of LVQ Neural Network - face orientation recognition

编写第一个C#应用程序——Hello, C#

Simulation of vector

潤邁德醫療通過上市聆訊:預計虧損將增加,霍雲飛兄弟持股約33%

What is the process of en 1101 flammability test for curtains?

主动学习(Active Learning) 概述、策略和不确定性度量

Stack awareness - stack overflow instance (ret2libc)

Laravel实现文件(图片)上传

Compose programming idea
随机推荐
Fishman: telecom customer churn prediction game scheme!
超分之RLSP
How can multidimensional analysis pre summary work?
Stack cognition - Introduction to heap
C language DLL Dynamic Link Library
如何把1000随机分配成10个数
EtherCAT igh 'Fatal Sync Error'——0x002C,0x001A
Window常用快捷键
Stack awareness - stack overflow instance (ret2text)
在国元期货开户做期货安全吗?
数字经济王宁教你如何正确地选择短期投资
是关于Linux中一步建立yum源缓存问题
堆栈认知——栈溢出实例(ret2text)
堆栈认知——栈溢出实例(ret2libc)
神经网络七十年:回顾与展望
Stack awareness - stack overflow instance (ret2libc)
list的使用
潤邁德醫療通過上市聆訊:預計虧損將增加,霍雲飛兄弟持股約33%
不是一流大学毕业,却通过自学软件测试,进了阿里年薪初始22K
POSIX共享内存