LeetCode Challenge #5: Defanging an IP Address

Problem Statement

Given a valid (IPv4) IP address, return a defanged version of that IP address.

A defanged IP address replaces every period “.” with “[.]”.

Example 1:

Input: address = "1.1.1.1"
Output: "1[.]1[.]1[.]1"

Step-by-Step Solution

--

--

--

A nerd in books, tea and programming. I publish weekly on my personal blog: https://lo-victoria.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Getting back on GTD, the 125th time

Microsoft Cloud and Basics of Virtual Machine

Kali Linux on Your Key-Chain USB

Setup Web Application Stack using AWS Services for Starter (+ PHP/Laravel mini-setup)

Understanding sorting: A super-simplified explanation

What is the difference between a hard link and a symbolic link?

Godot Tutorial: How to make a level progress bar on top

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Victoria Lo

Victoria Lo

A nerd in books, tea and programming. I publish weekly on my personal blog: https://lo-victoria.com/

More from Medium

Data Structures in Java

[Leetcode] 0. Java Data Structures

What is java?

Java Interview Questions — String Immutability & String Pool #1