목록프로그래머스 (93)
csct3434
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(String s) { Stack stack = new Stack(); for (char c : s.toCharArray()) { if (!stack.isEmpty() && stack.peek().equals(c)) { stack.pop(); continue; } stack.push(c); } return stack.isEmpty() ? 1 : 0; } }
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int[] arr) { int LCM = lcm(arr[0], arr[1]); for (int i = 2; i b) { int temp = a; a ..
문제 링크 class Solution { private int[][] isBlocked; private int size, answer = 0; public int solution(int n) { init(n); solve(0); return answer; } private void init(int n) { size = n; isBlocked = new int[n][n]; } public void solve(int row) { if (row == size) { answer++; return; } for (int col = 0; col < size; col++) { if (isBlocked[row][col] == 0) { setBlocked(row, col, true); solve(row + 1); setB..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public String solution(String s) { StringBuilder answer = new StringBuilder(); boolean isBehindWhiteSpace = true; for(String token : s.toLowerCase().split("")) { answer.append(isBehindWhiteSpace? token.toUpperCase() : token); isBehindWhiteSpace = token.equals(" ")..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int[][] solution(int[][] arr1, int[][] arr2) { int l = arr1.length; int m = arr1[0].length; int n = arr2[0].length; int[][] answer = new int[l][n]; for (int i = 0; i < l; i++) { for (int k = 0; k < n; k++) { int sum = 0; for (int j = 0; j < m; j++) { sum +=..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { private List result = new ArrayList(); public int[][] solution(int n) { move(n, 1, 3, 2); int[][] answer = new int[result.size()][2]; for (int i = 0; i < result.size(); i++) { answer[i] = result.get(i); } return answer; } public void move(int count, int from, int ..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public int solution(int n) { int answer = 0, beforeSecond = 0, beforeFirst = 1; for (int i = 2; i
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.Arrays; class Solution { public int solution(int[] A, int[] B) { int answer = 0; int length = A.length; Arrays.sort(A); Arrays.sort(B); for (int i = 0; i < length; i++) { answer += A[i] * B[length - 1 - i]; } return answer; } }
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr class Solution { public String solution(String s) { long max = Long.MIN_VALUE; long min = Long.MAX_VALUE; for (String strNum : s.split(" ")) { long num = Long.parseLong(strNum); max = Math.max(max, num); min = Math.min(min, num); } return String.valueOf(min) + " " + String.valueOf..
문제 링크 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include using namespace std; vector solution(int n, long long k) { if (n == 1) { return {1}; } vector answer(n, 0); int index = 0; long long a = 1; vector digits; for (int i = 1; i 2) { a /= n--; int subSequence = static_cast(1 + (k - 1) / a); answer[index++] = digits[subSequence..