본문 바로가기
728x90

코딩테스트9

[CodeTree]두 개의 직각삼각형 https://www.codetree.ai/missions/4/problems/two-right-triangle?&utm_source=clipboard&utm_medium=text 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai if문 뒤쪽의 조건에서 n 일 때의 값을 포함해야 n * 2 에 해당하는 모든 구간을 확인 할 수 있습니다.별찍기는 세로로 찍히는것이 아니고 가로로 하나씩 찍힙니다.또한 행을 건너다니는 것이 아니라 한 줄씩 작업한 후에 다음 줄로 이동합니다. 주어진 n의 값과 비례해 몇 배로 한줄씩 출력하는지 확인개행(다음 줄로 이동)을 언제하는.. 2024. 8. 6.
[CodeTree]조건에 부합하는 수 https://www.codetree.ai/missions/4/problems/number-that-meets-the-condition?&utm_source=clipboard&utm_medium=text 코드트리 | 코딩테스트 준비를 위한 알고리즘 정석국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.www.codetree.ai 정수 a 를 입력받아 1부터 a까지의 수 중 다음 조건을 모두 만족하지 않는 수들을 모두 출력하는 프로그램을 작성해보세요.짝수이면서 4의 배수가 아닌 수8로 나눈 몫이 짝수인 수7로 나눈 나머지가 4보다 작은 수  위 문제를 읽고 오해를 하는 분이 있다면 다음과 같이 생각해보자 짝수이면서 4의 배수가 아닌 .. 2024. 8. 6.
백준 2667번 단지번호붙이기(bfs, dfs) package graph;import java.util.*;public class Temp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.nextLine()); int[][] map = new int[N][N]; for (int i = 0; i result = new ArrayList(); for (int i = 0; i s = new Stack(); s.push(new int[]{x, y}); while (!s.isEmpty()) { int[].. 2024. 5. 20.
백준 2468번 안전영역(bfs, dfs) package graph;import java.util.LinkedList;import java.util.Queue;import java.util.Scanner;import java.util.Stack;public class BJ2468 { static int[][] direction = { {0, -1}, {1, 0}, {0, 1}, {-1, 0} }; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.nextLine()); int[][] area = new int[N][N]; i.. 2024. 5. 20.
[Programmers] OX퀴즈 public String[] solution(String[] quiz) { String[] answer = new String[quiz.length]; for (int i = 0; i < quiz.length; i++) { String[] quizArr = quiz[i].split(" "); int n1 = Integer.parseInt(quizArr[0]); int n2 = Integer.parseInt(quizArr[2]); answer[i] = (n1 + n2) * (quizArr[1].equals("+") ? 1 : -1) == Integer.parseInt(quizArr[4]) ? "O" : "X"; } return answer; } class Solution { public String[] s.. 2024. 4. 23.
[Programmers] 안전지대 public int solution(int[][] board) { // 전체 순회 중 지뢰(1)은 건너 뜀 for (int i = 0; i = 0 && k = 0 && l < board.length && board[k][l] != 1) { board[i][j]--; // 지뢰가 있으면 -1 } } } } } int answer = 0.. 2024. 4. 23.