목록알고리즘 (98)
forest_moon
학생 등급과 이름순 정렬 You are given two tables: Students and Grades. Students contains three columns ID, Name and Marks. Grades contains the following data: Ketty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn't want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are e..
아프리카의 모든 도시 목록 Given the CITY and COUNTRY tables, query the names of all cities where the CONTINENT is 'Africa'. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Input Format The CITY and COUNTRY tables are described as follows: SELECT city.name FROM city JOIN country ON country.code = city.countrycode AND country.continent = "Africa" ;
각 대륙별 도시의 인구수 평균 Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer. Note: CITY.CountryCode and COUNTRY.Code are matching key columns. Input Format The CITY and COUNTRY tables are described as follows: SELECT country.continent , FLOOR(AVG(city.population))..
문제 설명 정수가 담긴 리스트 num_list가 주어질 때, num_list의 원소 중 짝수와 홀수의 개수를 담은 배열을 return 하도록 solution 함수를 완성해보세요. 제한사항 1 ≤ num_list의 길이 ≤ 100 0 ≤ num_list의 원소 ≤ 1,000 입출력 예 설명 입출력 예 #1 [1, 2, 3, 4, 5]에는 짝수가 2, 4로 두 개, 홀수가 1, 3, 5로 세 개 있습니다. 입출력 예 #2 [1, 3, 5, 7]에는 짝수가 없고 홀수가 네 개 있습니다. class Solution { public int[] solution(int[] num_list) { int[] answer = new int[2]; int a = 0; int b = 0; for(int i = 0; i< nu..
직각삼각형 출력하기 문제 설명 "*"의 높이와 너비를 1이라고 했을 때, "*"을 이용해 직각 이등변 삼각형을 그리려고합니다. 정수 n 이 주어지면 높이와 너비가 n 인 직각 이등변 삼각형을 출력하도록 코드를 작성해보세요. 제한사항 1 ≤ n ≤ 10 입출력 예 입력 #1 3 출력 #1 * ** *** 입출력 예 설명 입출력 예 #1 n이 3이므로 첫째 줄에 * 1개, 둘째 줄에 * 2개, 셋째 줄에 * 3개를 출력합니다. import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i..
문제 설명 문자열 my_string이 매개변수로 주어집니다. my_string을 거꾸로 뒤집은 문자열을 return하도록 solution 함수를 완성해주세요. 제한사항 1 ≤ my_string의 길이 ≤ 1,000 입출력 예 설명 입출력 예 #1 my_string이 "jaron"이므로 거꾸로 뒤집은 "noraj"를 return합니다. 입출력 예 #2 my_string이 "bread"이므로 거꾸로 뒤집은 "daerb"를 return합니다. class Solution { public String solution(String my_string) { String answer = ""; for (int i = my_string.length() - 1; i >= 0; i--) { answer = answer + m..
짝수의 합 문제 설명 정수 n이 주어질 때, n이하의 짝수를 모두 더한 값을 return 하도록 solution 함수를 작성해주세요. 제한사항 0