일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- html
- JWT
- JPA
- jenkins
- session
- DI
- cookie
- bean
- Java
- oauth
- jQuery
- programmers
- Spring Security
- SseEmitter
- Stream
- 생명주기 콜백
- web
- WIL
- google oauth
- javascript
- server send event
- Anolog
- 항해99
- spring
- flask
- real time web
- Hibernate
- hanghae99
- Project
- python
- Today
- Total
목록Java (67)
끄적끄적 코딩일지
https://programmers.co.kr/learn/courses/30/lessons/12918 코딩테스트 연습 - 문자열 다루기 기본 문자열 s의 길이가 4 혹은 6이고, 숫자로만 구성돼있는지 확인해주는 함수, solution을 완성하세요. 예를 들어 s가 "a234"이면 False를 리턴하고 "1234"라면 True를 리턴하면 됩니다. 제한 사항 s는 길이 1 programmers.co.kr class Solution { public boolean solution(String s) { return solutionA(s); } // parseInt, try/catch 사용 public boolean solutionA(String s){ boolean answer = true; try{ int tm..
https://programmers.co.kr/learn/courses/30/lessons/12916 코딩테스트 연습 - 문자열 내 p와 y의 개수 대문자와 소문자가 섞여있는 문자열 s가 주어집니다. s에 'p'의 개수와 'y'의 개수를 비교해 같으면 True, 다르면 False를 return 하는 solution를 완성하세요. 'p', 'y' 모두 하나도 없는 경우는 항상 True를 programmers.co.kr import java.util.Arrays; class Solution { boolean solution(String s) { return solutionA(s); } // 솔루션 A public boolean solutionA(String s){ String tmp = toUpperCase..
https://programmers.co.kr/learn/courses/30/lessons/70128 코딩테스트 연습 - 내적 길이가 같은 두 1차원 정수 배열 a, b가 매개변수로 주어집니다. a와 b의 내적을 return 하도록 solution 함수를 완성해주세요. 이때, a와 b의 내적은 a[0]*b[0] + a[1]*b[1] + ... + a[n-1]*b[n-1] 입니다. (n은 a, b의 programmers.co.kr import java.util.Arrays; class Solution { int idx = 0; public int solution(int[] a, int[] b) { return solutionA(a,b); } // 단순 for문 이용 public int solutionA(i..
https://programmers.co.kr/learn/courses/30/lessons/12910 코딩테스트 연습 - 나누어 떨어지는 숫자 배열 array의 각 element 중 divisor로 나누어 떨어지는 값을 오름차순으로 정렬한 배열을 반환하는 함수, solution을 작성해주세요. divisor로 나누어 떨어지는 element가 하나도 없다면 배열에 -1을 담아 반환하 programmers.co.kr import java.util.Arrays; class Solution { public int[] solution(int[] arr, int divisor) { // stream 사용하기 // int[] answer =Arrays.stream(arr).filter(e->e%divisor == 0..
https://programmers.co.kr/learn/courses/30/lessons/12901 코딩테스트 연습 - 2016년 2016년 1월 1일은 금요일입니다. 2016년 a월 b일은 무슨 요일일까요? 두 수 a ,b를 입력받아 2016년 a월 b일이 무슨 요일인지 리턴하는 함수, solution을 완성하세요. 요일의 이름은 일요일부터 토요일까 programmers.co.kr class Solution { public String solution(int month, int day) { int sumDays = 0; // 1월 1일부터 입력Month까지 day수 계산 // ex) 5월까지라면 31+29+30+31+30 for(int i = 0 ; i < month; i++) sumDays += g..
https://programmers.co.kr/learn/courses/30/lessons/82612 코딩테스트 연습 - 부족한 금액 계산하기 새로 생긴 놀이기구는 인기가 매우 많아 줄이 끊이질 않습니다. 이 놀이기구의 원래 이용료는 price원 인데, 놀이기구를 N 번 째 이용한다면 원래 이용료의 N배를 받기로 하였습니다. 즉, 처음 이 programmers.co.kr class Solution { public long solution(int price, int money, int count) { long totalPrice = calPect(count) * price; long answer = totalPrice
https://programmers.co.kr/learn/courses/30/lessons/12954 코딩테스트 연습 - x만큼 간격이 있는 n개의 숫자 함수 solution은 정수 x와 자연수 n을 입력 받아, x부터 시작해 x씩 증가하는 숫자를 n개 지니는 리스트를 리턴해야 합니다. 다음 제한 조건을 보고, 조건을 만족하는 함수, solution을 완성해주세요. programmers.co.kr class Solution { public long[] solution(int x, int n) { long[] answer = new long[n]; for(int i = 0 ; i < answer.length; i++) answer[i] = x * (i+1L); return answer; } }
https://programmers.co.kr/learn/courses/30/lessons/12950 코딩테스트 연습 - 행렬의 덧셈 행렬의 덧셈은 행과 열의 크기가 같은 두 행렬의 같은 행, 같은 열의 값을 서로 더한 결과가 됩니다. 2개의 행렬 arr1과 arr2를 입력받아, 행렬 덧셈의 결과를 반환하는 함수, solution을 완성해주세요 programmers.co.kr class Solution { public int[][] solution(int[][] arr1, int[][] arr2) { int[][] answer = arr1; for(int i = 0 ; i < arr1.length;i++){ for(int j = 0 ; j < arr1[0].length; j++) answer[i][j] ..
https://programmers.co.kr/learn/courses/30/lessons/12948 코딩테스트 연습 - 핸드폰 번호 가리기 프로그래머스 모바일은 개인정보 보호를 위해 고지서를 보낼 때 고객들의 전화번호의 일부를 가립니다. 전화번호가 문자열 phone_number로 주어졌을 때, 전화번호의 뒷 4자리를 제외한 나머지 숫자 programmers.co.kr class Solution { public String solution(String phone_number) { String marker = new String(new char[phone_number.length()-4]).replace("\0","*"); String answer = marker + phone_number.substrin..
https://programmers.co.kr/learn/courses/30/lessons/12944 코딩테스트 연습 - 평균 구하기 정수를 담고 있는 배열 arr의 평균값을 return하는 함수, solution을 완성해보세요. 제한사항 arr은 길이 1 이상, 100 이하인 배열입니다. arr의 원소는 -10,000 이상 10,000 이하인 정수입니다. 입출력 예 arr programmers.co.kr import java.util.Arrays; class Solution { public double solution(int[] arr) { double answer = 0; for(int a : arr){ answer += a; } answer /= arr.length; return answer; } ..