목록분류 전체보기 (91)
눈송이의 개발생활
따로 Workbench를 열지 않고, IntelliJ 내에서 DB를 다루기 위해 IntelliJ에 내장되어 있는 기능을 사용할 것이다. DB를 연결하는 방법을 알아보자! 1. View → Tool Windows → Database 2. 우측에 Database 탭이 생기면 새로운 DB를 추가 ➕ 버튼 → Data Source → 사용할 데이터베이스 3. 사용할 DB에 대한 정보 입력 User와 Password 입력 → (드라이버 파일이 없으면 Test Connection 위에 다운 받으라고 뜸) 드라이버 파일 다운로드 → Test Connection → Apply or OK DB이름은 @localhost말고 사용하고 싶은거 적기! 4. DB 노출 설정하기 원하는 databse 이름은 체크하기 5. 콘솔 열..
문제 https://programmers.co.kr/learn/courses/30/lessons/42747 내 코드 def solution(citations): count = 0 citations.sort() for i in range(citations[-1] + 1): new_c = [j for j in range(len(citations)) if citations[j] >= i] if len(new_c) >= i: count = i else: break return count 다른 사람 풀이 def solution(citations): citations = sorted(citations) l = len(citations) for i in range(l): if citations[i] >= l-i: r..
문제 https://programmers.co.kr/learn/courses/30/lessons/42576 내 코드 #1 (실패) def solution(participant, completion): for i in range(len(completion)): if completion[i] in participant: participant.remove(completion[i]) answer = participant[0] if len(participant) != 0 else ' ' return answer 내 코드 #2 (성공) def solution(participant, completion): participant.sort() completion.sort() for p, c in zip(participa..
문제 https://programmers.co.kr/learn/courses/30/lessons/42748 내 코드 def solution(answers): students = [ [1, 2, 3, 4, 5], [2, 1, 2, 3, 2, 4, 2, 5], [3, 3, 1, 1, 2, 2, 4, 4, 5, 5] ] answer = [0, 0, 0] result = [] for i in range(len(answers)): if answers[i] == students[0][i % 5]: answer[0] += 1 if answers[i] == students[1][i % 8]: answer[1] += 1 if answers[i] == students[2][i % 10]: answer[2] += 1 m =..
문제 https://programmers.co.kr/learn/courses/30/lessons/42748 내 코드 def solution(array, commands): answer = [] for index in range(len(commands)): temp = [] i = commands[index][0] - 1 j = commands[index][1] k = commands[index][2] - 1 temp = array[i:j] temp.sort() answer.append(temp[k]) return answer 다른 사람 풀이 def solution(array, commands): answer = [] for command in commands: i,j,k = command answer.a..
🌱 JPA란 무엇인가? JPA는 자바 표준 ORM(Object Relational Mapping) 기술이다. ORM 기술은 객체를 매핑하는 것이고 JPA는 인터페이스이다. JPA는 서로 다른 패러다임인 객체 지향 프로그래밍 언어와 관계형 데이터베이스의 패러다임 일치를 시켜주기 위한 기술이다. 개발자가 객체지향 언어로 프로그래밍을 하면, JPA가 관계형 데이터베이스에 맞게 SQL을 생성해서 실행한다. 🌱 Spring Data JPA 인터페이스인 JPA를 사용하기 귀해 필요한 구현체(모듈) → Hibernate, Eclipse, Link 등 JPA ← Hibernate ← Spring Data JPA Spring Data JPA 장점 구현체 교체 용이 : Hibernate 외의 다른 구현체(Link, Let..
문제 https://programmers.co.kr/learn/courses/30/lessons/42862 내 코드 def solution(n, lost, reserve): s_res = set(reserve) - set(lost) s_lost = set(lost) - set(reserve) for i in s_res: if i - 1 in s_lost: s_lost.remove(i - 1) elif i + 1 in s_lost: s_lost.remove(i + 1) return n - len(s_lost) 다른 사람 풀이 def solution(n, lost, reserve): _reserve = [r for r in reserve if r not in lost] _lost = [l for l in l..
문제 https://programmers.co.kr/learn/courses/30/lessons/17682 내 코드 def solution(dartResult): dartResult = dartResult.replace('10', 'k') bonus = {'S': 1, 'D': 2, 'T': 3} temp = [] for i in dartResult: if i.isdigit(): temp.append(int(i)) elif i == 'k': temp.append(10) elif i in bonus: temp[-1] = temp[-1] ** bonus[i] elif i == '#': temp[-1] *= -1 elif i == '*': temp[-1] *= 2 if len(temp) > 1: temp[-2..