본문 바로가기

전체 글

(278)
[Hackerrank] Loops Objective In this challenge, we will use loops to do some math. Check out the Tutorial tab to learn more. Task Given an integer, , print its first multiples. Each multiple (where ) should be printed on a new line in the form: n x i = result. Example The printout should look like this: 3 x 1 = 3 3 x 2 = 6 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15 3 x 6 = 18 3 x 7 = 21 3 x 8 = 24 3 x 9 = 27 3 x 10 = 30 Inpu..
[Programmers] Level2. 전화번호 목록 (JAVA) 전화번호부에 적힌 전화번호 중, 한 번호가 다른 번호의 접두어인 경우가 있는지 확인하려 합니다. 전화번호가 다음과 같을 경우, 구조대 전화번호는 영석이의 전화번호의 접두사입니다. 구조대 : 119 박준영 : 97 674 223 지영석 : 11 9552 4421 전화번호부에 적힌 전화번호를 담은 배열 phone_book 이 solution 함수의 매개변수로 주어질 때, 어떤 번호가 다른 번호의 접두어인 경우가 있으면 false를 그렇지 않으면 true를 return 하도록 solution 함수를 작성해주세요. 제한 사항 phone_book의 길이는 1 이상 1,000,000 이하입니다. 각 전화번호의 길이는 1 이상 20 이하입니다. 같은 전화번호가 중복해서 들어있지 않습니다. 입출력 예제 phone_bo..
[Programmers] Level2. 기능개발(JAVA) 프로그래머스 팀에서는 기능 개선 작업을 수행 중입니다. 각 기능은 진도가 100%일 때 서비스에 반영할 수 있습니다. 또, 각 기능의 개발속도는 모두 다르기 때문에 뒤에 있는 기능이 앞에 있는 기능보다 먼저 개발될 수 있고, 이때 뒤에 있는 기능은 앞에 있는 기능이 배포될 때 함께 배포됩니다. 먼저 배포되어야 하는 순서대로 작업의 진도가 적힌 정수 배열 progresses와 각 작업의 개발 속도가 적힌 정수 배열 speeds가 주어질 때 각 배포마다 몇 개의 기능이 배포되는지를 return 하도록 solution 함수를 완성하세요. 제한 사항 작업의 개수(progresses, speeds배열의 길이)는 100개 이하입니다. 작업 진도는 100 미만의 자연수입니다. 작업 속도는 100 이하의 자연수입니다...
[Hackerrank] Class vs. Instance Objective In this challenge, we're going to learn about the difference between a class and an instance; because this is an Object Oriented concept, it's only enabled in certain languages. Check out the Tutorial tab for learning materials and an instructional video! Task Write a Person class with an instance variable, age, and a contructor that takes an integer, initialAge, as a parameter. The co..
[Baekjoon] 10171번 / 고양이 문제 아래 예제와 같이 고양이를 출력하시오. 입력 없음 출력 고양이를 출력한다. 예제 출력 \ /\ ) ( ') ( / ) \(__)| import java.util.*; public class Main { public static void main(String[] args) { System.out.println("\\ /\\"); System.out.println(" ) ( ')"); System.out.println("( / )"); System.out.println(" \\(__)|"); } }
[Baekjoon] 8393번 / 합 문제 n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오. 입력 첫째 줄에 n (1
[Baekjoon] 2742번 / 기찍 N 문제 자연수 N이 주어졌을 때, N부터 1까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 100,000보다 작거나 같은 자연수 N이 주어진다. 출력 첫째 줄부터 N번째 줄 까지 차례대로 출력한다. 예제 입력 5 예제 출력 5 4 3 2 1 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); for(int i=N; i>0; i--) { System.out.println(i); } } }
[Hackerrank] Intro to Conditional Statements Objective In the challenge, we learn about conditional statements. Check out the Turorial tab for learning materials and an instructional video. Task Given an integer, n, perform the following confitional actions: if n is odd, print Weird if n is even and in the inclusive range of 2 to 5, print Not Weird if n is even and in the inclusive range of 6 to 20, print Weird if n is even and greater tha..