File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 296
296
| 1089 | [ Duplicate Zeroes] ( https://leetcode.com/problems/duplicate-zeros ) | [ ![ Java] ( assets/java.png )] ( src/DuplicateZeros.java ) | |
297
297
| 1099 | 🔒 [ Two Sum Less Than K] ( https://leetcode.com/problems/two-sum-less-than-k ) | | |
298
298
| 1103 | [ Distribute Candies to People] ( https://leetcode.com/problems/distribute-candies-to-people ) | [ ![ Java] ( assets/java.png )] ( src/DistributeCandiesToPeople.java ) | |
299
- | 1108 | [ Defanging an IP Address] ( https://leetcode.com/problems/defanging-an-ip-address ) | | |
299
+ | 1108 | [ Defanging an IP Address] ( https://leetcode.com/problems/defanging-an-ip-address ) | [ ![ Java ] ( assets/java.png )] ( src/DefangingAnIPAddress.java ) | |
300
300
| 1118 | [ Number of Days in a Month] ( https://leetcode.com/problems/number-of-days-in-a-month ) | | |
301
301
| 1119 | [ Remove Vowels From String] ( https://leetcode.com/problems/remove-vowels-from-a-string ) | | |
302
302
| 1122 | [ Relative Sort Array] ( https://leetcode.com/problems/relative-sort-array ) | | |
Original file line number Diff line number Diff line change
1
+ public class DefangingAnIPAddress {
2
+ public String defangIPaddr (String address ) {
3
+ StringBuilder result = new StringBuilder ();
4
+ for (int i = 0 ; i < address .length () ; i ++) {
5
+ result .append (address .charAt (i ) == '.' ? "[.]" : address .charAt (i ));
6
+ }
7
+ return result .toString ();
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments