Added 25 solutions

This commit is contained in:
rshaghoulian
2017-02-24 00:24:47 -06:00
parent 05ce4b1476
commit af8c2969a4
50 changed files with 1562 additions and 277 deletions
+15 -1
View File
@@ -2,6 +2,20 @@
// Github: github.com/rshaghoulian
// HackerRank: hackerrank.com/rshaghoulian
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
class Solution {
public static void main(String []args) {
Scanner in = new Scanner(System.in);
while(in.hasNext()) {
String IP = in.next();
System.out.println(IP.matches(new MyRegex().pattern));
}
}
}
/*
[01]?\\d{1,2} matches numbers 0-199.
2[0-4]\\d matches numbers 200-249
@@ -10,4 +24,4 @@
class MyRegex {
String num = "([01]?\\d{1,2}|2[0-4]\\d|25[0-5])";
String pattern = num + "." + num + "." + num + "." + num;
}
}