목록Algorithm (127)
main
* 최대공약수 : gcd private static int gcdMethod(int a, int b) { BigInteger b1 = BigInteger.valueOf(a); BigInteger b2 = BigInteger.valueOf(b); BigInteger gcd = b1.gcd(b2); return gcd.intValue(); } * 최소공배수 : lcm * 기약분수 : 분자와 분모를 최대공약수로 나눠준다. import java.math.BigInteger; class Solution { public int[] solution(int denum1, int num1, int denum2, int num2) { int denum = denum1 * num2 + denum2 * num1; int nu..
class Solution { public int solution(String[] babbling) { int answer = 0; for (String string : babbling) { System.out.println(string); string = string.replaceAll("aya", " "); string = string.replaceAll("ye", " "); string = string.replaceAll("woo", " "); string = string.replaceAll("ma", " "); string = string.replaceAll(" ", ""); if (string.length() == 0) { answer++; } } return answer; } }
SELECT HOUR(DATETIME) AS 'HOUR', COUNT(ANIMAL_ID) AS 'COUNT' FROM ANIMAL_OUTS WHERE HOUR(DATETIME) >= 9 AND HOUR(DATETIME)
SELECT ANIMAL_TYPE, COUNT(ANIMAL_TYPE) AS 'count' FROM ANIMAL_INS WHERE ANIMAL_TYPE = 'Cat' OR ANIMAL_TYPE = 'Dog' GROUP BY ANIMAL_TYPE ORDER BY ANIMAL_TYPE;