본문 바로가기

분류 전체보기44

[알고리즘] LeetCode - Contains Duplicate II Contains Duplicate II - LeetCode Can you solve this real interview question? Contains Duplicate II - Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) 2023. 8. 31.
[알고리즘] LeetCode - Two Sum Two Sum - LeetCode Can you solve this real interview question? Two Sum - Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not leetcode.com 문제 설명 정수형 배열 nums가 주어진다. 두 숫자의 합인 정수형 변수 target이 주어진다. nums안의 두 숫자를 더해 target되는 경우에 두 수의 인덱스를 정수형 배열 형태로 반환한다... 2023. 8. 31.
[알고리즘] LeetCode - Evaluate Reverse Polish Notation Evaluate Reverse Polish Notation - LeetCode Can you solve this real interview question? Evaluate Reverse Polish Notation - You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation [http://en.wikipedia.org/wiki/Reverse_Polish_notation]. Evaluate t leetcode.com 문제 설명 역 폴란트 표기법이라고 하지만 쉽게 말해 후위 표기법이다. 후위 표기법으로 주어진 식이 문자형 배열로 주어진다. 후위표기법으로 표기된 식을 .. 2023. 8. 31.
[알고리즘] LeetCode - Min Stack Min Stack - LeetCode Can you solve this real interview question? Min Stack - Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: * MinStack() initializes the stack object. * void push(int val) pushes t leetcode.com 문제 설명 push, pop, top 반환, stack에서의 최솟값 반환을 지원하는 스택을 설계해야 한다. 기능에 해당하는 로직을 구현해야 한다. 문제 해결 별도의 Nodo에 val과 push.. 2023. 8. 31.
[Spring] JUnit5 기반 기능 구현해보기 - Repository 단위 테스트 사전 준비 서브 도메인 브랜치 생성 후 Entity 생성 Entity와 대응하는 Repository 생성 테스트 환경만의 application-test.yml spring: config: activate: on-profile: test# 테스트 클래스에서 설정 파일을 구분하기 위한 프로필명을 설정 datasource: url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL username: sa password: driver-class-name: org.h2.Driver jpa: hibernate: ddl-auto: create-drop# 매 실행마다 데이터베이스를 삭제하고 새로 생성하는 설정 properties: hibern.. 2023. 8. 31.