Java (501) 썸네일형 리스트형 [JAVA] 프로그래머스 - 문자열 계산하기 https://school.programmers.co.kr/learn/courses/30/lessons/120902 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 정답 class Solution { public int solution(String my_string) { String arr[] = my_string.split(" "); //공백으로 구분 int answer = Integer.parseInt(arr[0]); for(int i=0; i 다른 사람의 풀이 impor.. [JAVA] 프로그래머스 - 가장 큰 수 찾기 https://school.programmers.co.kr/learn/courses/30/lessons/120899 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 정답 class Solution { public int[] solution(int[] array) { int[] answer = new int[2]; int max = 0; int idx = 0; for(int i=0; imax) { max = array[i]; .. [JAVA] 프로그래머스 - 편지 https://school.programmers.co.kr/learn/courses/30/lessons/120898 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 정답 class Solution { public int solution(String message) { int answer = 0; int len = message.length(); answer = len*2; return answer; }} [자바 알고리즘 인터뷰] 8장 연결 리스트(6) - 홀짝 연결 리스트 https://leetcode.com/problems/odd-even-linked-list/description/ - 연결 리스트를 홀수 번째 노드 다음에 짝수 번째 노드가 오도록 재구성하라. 공간 복잡도 O(1), 시간복잡도 O(n)에 풀이하라 풀이 1) 반복 구조로 홀짝 노드 처리 - 홀수 노드 다음에 짝수 노드가 오게 재구성하라고 했으니 홀(Odd), 짝(Even) 각 노드를 구성한 다음 홀수 노드의 마지막을 짝수 노드의 처음과 이어 주면 될 것같다. - 홀수 노드 odd는 1에서 시작하고, 짝수 노드 even은 2에서 시작해 1->3->5, 2->4->6으로 이어지게 한 다음, 홀수 노드의 마지막인 5의 다음 노드를 짝수 노드의 처음인 2로 이어주면 된다. - 짝수 노드가 존재한다면 계.. [자바 알고리즘 인터뷰] 8장 연결 리스트(5) - 페어의 노드 스왑 https://leetcode.com/problems/swap-nodes-in-pairs/description/ - 연결 리스트를 입력받아 페어(pair)단위로 스왑하라 풀이 1) 값만 교환 - 연결 리스트의 노드를 변경하는 게 아닌, 노드 구조는 그대로 유지하되 값만 변경하는 방법 class Solution { public ListNode swapPairs(ListNode head) { //스왑을 진행할 노드 선언 ListNode node = head; //현재 노드와 다음 노드가 존재하면 계속 진행 while(node != null && node.next!=null) { //임시 변수를 이용해 값만 교환.. [JAVA] SWEA 1976. 시각 덧셈 https://swexpertacademy.com/main/solvingProblem/solvingProblem.do SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com 정답 import java.util.Scanner;class Solution{ public static void main(String args[]) throws Exception { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int t=1; t12) { ans_t = sum/60-12; } else { ans_t = sum/60; } .. [JAVA] SEWA 1979. 어디에 단어가 들어갈 수 있을까 https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AV5PuPq6AaQDFAUq&categoryId=AV5PuPq6AaQDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=JAVA&select-1=2&pageSize=10&pageIndex=1 SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com 정답 import java.util.Scanner;class Solution{ public static void main.. [JAVA] SWEA 1983. 조교의 성적 매기기 https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AV5PwGK6AcIDFAUq&categoryId=AV5PwGK6AcIDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=JAVA&select-1=2&pageSize=10&pageIndex=1 SW Expert AcademySW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!swexpertacademy.com 정답 import java.util.Scanner;import java.util.Arrays;class Solution{.. 이전 1 ··· 15 16 17 18 19 20 21 ··· 63 다음