알고리즘 코드카타
Students and Examinations
with student_exam as (
select a.student_id, a.student_name, b.subject_name
from students a
join Subjects b
)
select a.student_id, a.student_name, a.subject_name, count(b.subject_name) as attended_exams
from student_exam a
left join Examinations b
on a.subject_name = b.subject_name
and a.student_id = b.student_id
group by a.student_id, a.subject_name
order by a.student_id asc, a.subject_name asc
;
덧칠하기
class Solution {
public int solution(int n, int m, int[] section) {
if(m==0){
return 0;
}
int answer = 0;
int result = section[0] - 1;
for (int i = 0; i < section.length; i++) {
if (section[i] > result){
answer++;
result = section[i] + m - 1;
}
}
return answer;
}
}