전체 글 69

[Java] 26. Remove Duplicates from Sorted Array

난이도: EASY문제더보기Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of unique elements in nums. Consider the number of unique elements of nums to be k, to get accepted, you need to do the following things: Change the array nums s..

[SQL50] 1148. Article Views I

난이도: EASY 문제더보기Table: Views +---------------+---------+ | Column Name   | Type    | +---------------+---------+ | article_id    | int     | | author_id     | int     | | viewer_id     | int     | | view_date     | date    | +---------------+---------+ There is no primary key (column with unique values) for this table, the table may have duplicate rows. Each row of this table indicates that some ..

[SQL50] 1683. Invalid Tweets

난이도: EASY 문제더보기Table: Tweets+----------------+---------+ | Column Name    | Type    | +----------------+---------+ | tweet_id       | int     | | content        | varchar | +----------------+---------+ tweet_id is the primary key (column with unique values) for this table. content consists of characters on an American Keyboard, and no other special characters. This table contains all the tweets ..

JUnit5를 이용한 단위 테스트

소스 작성중 JUnit 이 임포트가 안되는 문제가 생김.그래들엔 분명 spring-boot-starter-test 의존성이 있고, 책에선 이게 JUnit5, 모키토, 어서트J 같은 테스트 라이브러리를 프로젝트로 임포트 한다고 써있는데...! package com.polarbookshop.catalogservice.domain;import jakarta.validation.Validation;import jakarta.validation.Validator;import jakarta.validation.ValidatorFactory;import org.junit.jupiter.api.BeforeAll;//Book 객체의 유효성 검사 제약조건을 검증하기 위한 단위 테스트public class BookValid..

[Java] 21. Merge Two Sorted Lists

난이도: EASY문제더보기You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. Example 1: Input: list1 = [1,2,4], list2 = [1,3,4] Output: [1,1,2,3,4,4]Example 2: Input: list1 = [], list2 = [] Output: [] Example 3: Input: list1 = []..

[SQL50] 595. Big Countries

난이도: EASY 문제더보기Table: World +-------------+---------+ | Column Name | Type    | +-------------+---------+ | name        | varchar | | continent   | varchar | | area        | int     | | population  | int     | | gdp         | bigint  | +-------------+---------+ name is the primary key (column with unique values) for this table. Each row of this table gives information about the name of a country..

[SQL50] 584. Find Customer Referee

난이도: EASY 문제더보기Table: Customer+-------------+--------------+ | Column Name | Type | +-------------+--------------+ | id                | int          | | name         | varchar   | | referee_id  | int           | +-------------+--------------+ In SQL, id is the primary key column for this table. Each row of this table indicates the id of a customer, their name, and the id of the customer who ref..

중앙식 예외 핸들러와 이를 이용한 오류 처리

112p ~ @RestControllerAdvice 클래스는 예외와 상태 코드 사이의 매핑을 제공. 카탈로그에 이미 있는 책 생성시 422(처리할 수 없는 개체), 존재하지 않는 책을 가져오려할 때는 404(찾을 수 없음), Book 객체에서 하나 이상의 필드가 잘못되었을 때는 400(잘못된 요청) 응답 반환. package com.polarbookshop.catalogservice.web;import com.polarbookshop.catalogservice.domain.BookAlreadyExistsException;import com.polarbookshop.catalogservice.domain.BookNotFoundException;import org.springframework.http.Htt..

데이터 유효성 검사

109p ~ 111p 유효성 검사를 해야할 조건은 아래와 같다. ISBN은 올바른 형식으로 정의되어야 한다(ISBN-10 or 13)제목, 저자, 가격은 반드시 있어야하고 가격은 0보다 큰 값이어야 한다.plugins { id 'java' id 'org.springframework.boot' version '3.4.1' id 'io.spring.dependency-management' version '1.1.7'}group = 'com.polarbookshop'version = '0.0.1-SNAPSHOT'java { toolchain { languageVersion = JavaLanguageVersion.of(17) }}repositories { mavenCentral()}dependencies { ..

스프링 MVC를 이용한 REST API 구현, 그리고 Httpie 설치와의 사투

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 넘나 멍청하게 ./gradlew bootRun 치고 왜 안되지...... 이러고 있다가 윈도우터미널인걸 깨닫...하 바보가태 윈도우면 gradlew.bat bootRun 으로 실행 근데 또 오류낫쥬...? ㅎㅎ.... 더보기11:12:27.135 [main] ERROR org.springframework.boot.SpringApplication -- Application run failed org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here  in 'reader', line 2, column 7:     server:           ^      ..