
12.1 스프링 데이터 JPA 소개 스프링 데이터 JPA > 프레임워크에서 JPA를 편리하게 사용할수 있도록 지원하는 프로젝트이다. > 데이터 접근 계층을 개발할 때 지루하게 반복되는 CRUD 문제를 공통 인터페이스로 제공 > 인터페이스만 작성하면 JPA가 어플리케이션 실행 시점에 구현 객체를 생성해서 주입해줌 > 직접 작성한 메소드, 스프링 데이터 jpa가 메소드 이름을 분석해서 jpql을 실행해준다. 12.1.1 스프링 데이터 프로젝트 - 스프링 데이터 프로젝트 : 다양한 데이터 저장소 접근을 추상화하하여 개발 편의를 제공하는 프로젝트 - 스프링 데이터 JPA는 스프링 데이터 프로젝트의 하위 프로젝트중 하나이다. 12.2 스프링 데이터 JPA 설정 1) mavan 라이브러리 추가 > spring-da..
Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1. Example 1: Input: nums = [0,1] Output: 2 Explanation: [0, 1] is the longest contiguous subarray with an equal number of 0 and 1. Example 2: Input: nums = [0,1,0] Output: 2 Explanation: [0, 1] (or [1, 0]) is a longest contiguous subarray with equal number of 0 and 1. 문제 : 0,1 로 이루어진 배열이 ..
You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. Example 1: Input: s = "abcd", t = "abcde" Output: "e" Explanation: 'e' is the letter that was added. Example 2: Input: s = "", t = "y" Output: "y" 문제 : String s, t 의 다른 문자를 찾아라 풀이 class Solution { public char findTheDiffer..
Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array nums. More formally, if there are k element..
You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Example 1: Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] Explanation: The linked-lists are: [ 1->4->5, 1->3->4, 2->6 ] merging them into one sorted list: 1->1->2->3->4->4->5->6 문제 : lists로 주어진 링크드리스트를 하나의 링크드리스트로 합..
You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0. Example 1: Input: prices = [7,1,5,3,6,4] Output: 5 Explanat..

Given two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: root1 = [2,1,4], root2 = [1,0,3] Output: [0,1,1,2,3,4] Example 2: Input: root1 = [1,null,8], root2 = [8,1] Output: [1,1,8,8] 문제 : TreeNode 가 2개 주어지는데, root1, root2 노드값을 list 하나로 묶어서 정렬하여 리턴하라 풀이1 class Solution { public List getAllElements(TreeNode..
There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station. You begin the journey with an empty tank at one of the gas stations. Given two integer arrays gas and cost, return the starting gas station's index if you can trav..

Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 arr[i + 1] > ... > arr[arr.length - 1] Example 1: Input: arr = [2,1] Output: false Example 2: Input: arr = [3,5,5] Output: false ..
We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All letters in this word are not capitals, like "leetcode". Only the first letter in this word is capital, like "Google". Given a string word, return true if the usage of capitals in it is right. Example 1: Input: word = "USA" Output: true Example 2: Inp..