Refactored all solutions

This commit is contained in:
rshaghoulian
2017-04-05 18:42:35 -05:00
parent 5f4c2f4a78
commit decc8e791e
135 changed files with 848 additions and 849 deletions
+3 -2
View File
@@ -25,13 +25,14 @@ class Prime {
if (n < 2) {
return false;
}
for (int i = 2; i <= (int) Math.sqrt(n); i++) {
int sqrt = (int) Math.sqrt(n);
for (int i = 2; i <= sqrt; i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
}
}
public class Solution {