분류 전체보기

TroubleShooting

[EC2-RDS 오류] Caused by: java.security.cert.CertificateExpiredException: NotAfter:

1. 발생한 문제Caused by: javax.net.ssl.SSLHandshakeException: NotAfter: Thu Aug 22 17:08:50 UTC 2024Caused by: java.security.cert.CertificateExpiredException: NotAfter: Thu Aug 22 17:08:50 UTC 2024 갑자기 어느날 방치해둔 서버에 와장창창 500 오류가 떴다.. 참고로 저 DB 오류가 뜨면서 org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction 도 로그에 같이 떠서 멘붕이었다.  2. 해결 방법너무 간단해 킹 받..

Coding Test

[TIL/05.08] Leetcode: Best Time to Buy and Sell Stock (Python)

문제https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ 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, retur..

Coding Test

[TIL/05.07] Leetcode: 3Sum (Python)

문제Link Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.Notice that the solution set must not contain duplicate triplets. Example 1:Input: nums = [-1,0,1,2,-1,-4]Output: [[-1,-1,2],[-1,0,1]]Explanation: nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0.nums[1] + nums[2] + nums[4] = 0 + 1 + (-1..

Coding Test

[TIL/05.07] Leetcode: Group Anagrams (Python)

문제A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.Given a string s, return true if it is a palindrome, or false otherwise. Example 1:Input: s = "A man, a plan, a canal: Panama"Output: trueExplanation: "amanaplanacanal..

Coding Test

[TIL/05.06] Leetcode: Group Anagrams (Python)

문제Given an array of strings strs, group the anagrams together. You can return the answer in any order.문자열을 받아 애너그램 단위로 그루핑하라.  입출력 예시Example 1:Input: strs = ["eat","tea","tan","ate","nat","bat"]Output: [["bat"],["nat","tan"],["ate","eat","tea"]]Example 2:Input: strs = [""]Output: [[""]]Example 3:Input: strs = ["a"]Output: [["a"]] 해설 풀이from collections import defaultdictclass Solution: def gro..

Coding Test

[TIL/04.12] Algorithm: Greedy (Java)

출처: 프로그래머스1. 문제 프로그래머스 - 귤 고르기  문제 설명경화는 과수원에서 귤을 수확했습니다. 경화는 수확한 귤 중 'k'개를 골라 상자 하나에 담아 판매하려고 합니다. 그런데 수확한 귤의 크기가 일정하지 않아 보기에 좋지 않다고 생각한 경화는 귤을 크기별로 분류했을 때 서로 다른 종류의 수를 최소화하고 싶습니다.예를 들어, 경화가 수확한 귤 8개의 크기가 [1, 3, 2, 5, 4, 5, 2, 3]이라고 합시다. 경화가 귤 6개를 판매하고 싶다면, 크기가 1, 4인 귤을 제외한 여섯 개의 귤을 상자에 담으면, 귤의 크기의 종류가 2, 3, 5로 총 3가지가 되며 이때가 서로 다른 종류가 최소일 때입니다.경화가 한 상자에 담으려는 귤의 개수 k와 귤의 크기를 담은 배열 tangerine이 매개변..

Coding Test

[TIL/04.11] Algorithm: 정렬 (Java)

1. 문제 - 프로그래머스 가장 큰 수 문제 설명0 또는 양의 정수가 주어졌을 때, 정수를 이어 붙여 만들 수 있는 가장 큰 수를 알아내 주세요.예를 들어, 주어진 정수가 [6, 10, 2]라면 [6102, 6210, 1062, 1026, 2610, 2106]를 만들 수 있고, 이중 가장 큰 수는 6210입니다.0 또는 양의 정수가 담긴 배열 numbers가 매개변수로 주어질 때, 순서를 재배치하여 만들 수 있는 가장 큰 수를 문자열로 바꾸어 return 하도록 solution 함수를 작성해주세요. 제한 사항numbers의 길이는 1 이상 100,000 이하입니다.numbers의 원소는 0 이상 1,000 이하입니다.정답이 너무 클 수 있으니 문자열로 바꾸어 return 합니다.입출력 예numbersre..

Coding Test

[TIL/04.10] Algorithm: 정렬 (Java)

1. 문제 문자열로 구성된 리스트 strings와 정수 n이 주어졌을 때, 각 문자열의 인덱스 n번째 글자를 기준으로 오름차순 정렬하려 합니다. 예를 들어 strings가 ["sun", "bed", "car"]이고 n이 1이면 각 단어의 인덱스 1의 문자 "u", "e", "a"로 strings를 정렬합니다. 제한 조건 1. strings는 길이 1이상, 50이하인 배열입니다. 2. strings의 원소는 소문자 알파벳으로 이루어져 있습니다. 3. strings의 원소는 길이 1이상, 100이하인 문자열입니다. 4. 모든 strings의 원소의 길이는 n보다 큽니다. 5. 인덱스 1의 문자가 같은 문자열이 여럿 일 경우, 사전순으로 앞선 문자열이 앞쪽에 위치합니다. 입출력 예 strings n retur..

Coding Test

[TIL/04.10] Algorithm: 백트래킹 (Java)

1. 문제 1부터 N까지 숫자 중 합이 10이 되는 조합 구하기 입출력 예시 N result 5 [[1,2,3,4], [1,4,5], [2,3,5]] 2. 코드 import java.util.*; class Solution { private static ArrayList result; private static int n; private static void backtrack(int sum, ArrayList selectedNums, int start){ // 합이 10이 되면 if (sum == 10){ result.add(selectedNums); return; } for (int i = start; i = Dungeons[i][0]){ visited[i] = true; // 방문 처리 // 2. 현..

Coding Test

[TIL/04.09] Algorithm: Set (Java)

출처: 프로그래머스 코딩테스트 연습 kit 🎱 영어 끝말잇기 1. 문제설명 문제 설명 1부터 n까지 번호가 붙어있는 n명의 사람이 영어 끝말잇기를 하고 있습니다. 영어 끝말잇기는 다음과 같은 규칙으로 진행됩니다. 1번부터 번호 순서대로 한 사람씩 차례대로 단어를 말합니다. 마지막 사람이 단어를 말한 다음에는 다시 1번부터 시작합니다. 앞사람이 말한 단어의 마지막 문자로 시작하는 단어를 말해야 합니다. 이전에 등장했던 단어는 사용할 수 없습니다. 한 글자인 단어는 인정되지 않습니다. 다음은 3명이 끝말잇기를 하는 상황을 나타냅니다. tank → kick → know → wheel → land → dream → mother → robot → tank 위 끝말잇기는 다음과 같이 진행됩니다. 1번 사람이 자신의..

Yeni.Yeni
'분류 전체보기' 카테고리의 글 목록