文件名称:leetcode伪代码-defang-an-ip-address:defang-an-ip-地址
文件大小:3KB
文件格式:ZIP
更新时间:2024-07-20 13:43:51
系统开源
leetcode伪代码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 "[.]". 解读: 给定一个合法的ip字串address 举例来说: "127.0.0.1" 返回一个字串把"."代换为"[.]" 举例来说: "127.0.0.1" => "127[.]0[.]0[.]1" 初步解法: 初步观察: 首先只需要先把输入的address 对"." 做split 然后在用"[.]" join为回去 初步设计: Given a valid ipv4 string address set a empty string formatedStr = "" set splitedAdrs = address.split(".") formatedStr = splitedAdrs.join("[.]")
【文件预览】:
defang-an-ip-address-master
----defangIPaddr.go(189B)
----README.md(2KB)
----.gitignore(269B)
----defangIPaddr_test.go(597B)