728x90
데일리루틴 SQL
MySQL 년, 월, 성별 별 상품 구매 회원 수 구하기 정답입니다.
SELECT
YEAR(S.SALES_DATE) AS YEAR,
MONTH(S.SALES_DATE) AS MONTH,
U.GENDER,
COUNT(DISTINCT S.USER_ID) AS USERS
FROM
ONLINE_SALE S
JOIN
USER_INFO U
ON
S.USER_ID = U.USER_ID
WHERE
U.GENDER IS NOT NULL
GROUP BY
YEAR(S.SALES_DATE), MONTH(S.SALES_DATE), U.GENDER
ORDER BY
YEAR(S.SALES_DATE), MONTH(S.SALES_DATE), U.GENDER;
데일리루틴 알고리즘
Java 기사단원의 무기 정답입니다.
class Solution {
public int solution(int number, int limit, int power) {
int answer = 0;
for (int i = 1; i <= number; i++) {
int count = 0;
for (int j = 1; j * j <= i; j++) {
if (i % j == 0) {
count++;
if (j != i / j) {
count++;
}
}
}
answer += count > limit ? power : count;
}
return answer;
}
}
728x90
반응형
LIST
'Sparta > 데일리루틴' 카테고리의 다른 글
TIL(Today I Learned)_데일리루틴_24.12.07.Sat (0) | 2024.12.07 |
---|---|
TIL(Today I Learned)_데일리루틴_24.12.06.Fri (0) | 2024.12.06 |
TIL(Today I Learned)_데일리루틴_24.12.04.Wed (0) | 2024.12.04 |
TIL(Today I Learned)_데일리루틴_24.12.03.Tue (0) | 2024.12.03 |
TIL(Today I Learned)_데일리루틴_24.12.02.Mon (0) | 2024.12.02 |