Topic label: String
Title gave us a set of ip address, let's. Become [.], This problem can replace, but to do so, did not seem to make sense. We still go about the array, specifically to see the code.
Java Solution:
Runtime: 0 ms, faster than 100 %
Memory Usage: 34 MB, less than 100 %
Completion Date: 08/01/2019
Key: n / a
class Solution { public String defangIPaddr(String address) { char[] charsArr = address.toCharArray(); StringBuilder sb = new StringBuilder(); for(char c : charsArr) { if(c == '.') sb.append("[.]"); else sb.append(c); } return sb.toString(); } }
LeetCode title list - LeetCode Questions List
Topic Source: https: //leetcode.com/