만족은 하되 안주하지는 말자

기록해야 기억한다

전체 글 168

[leetcode] Smallest String With A Given Numeric Value

문제 https://leetcode.com/problems/smallest-string-with-a-given-numeric-value/ Smallest String With A Given Numeric Value - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 내 풀이 class Solution { public String getSmallestString(int n, int k) { int remain = k - n; char[] array = new cha..

[python] k진수에서 소수 개수 구하기

문제 https://programmers.co.kr/learn/courses/30/lessons/92335# 코딩테스트 연습 - k진수에서 소수 개수 구하기 문제 설명 양의 정수 n이 주어집니다. 이 숫자를 k진수로 바꿨을 때, 변환된 수 안에 아래 조건에 맞는 소수(Prime number)가 몇 개인지 알아보려 합니다. 0P0처럼 소수 양쪽에 0이 있는 경우 P0처럼 소 programmers.co.kr 내 풀이 import math import re prime_list = set() def solution(n, k): answer = 0 num = modify(n, k) split = re.split('0+', num) for num in split: if not num: continue i = int..

[leetcode] 1007. Minimum Domino Rotations For Equal Row

문제 https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/ Minimum Domino Rotations For Equal Row - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 내 풀이 import java.util.Arrays; class Solution { public int minDominoRotations(int[] tops, int[] bottoms) { int[] rotation..

[JAVA] 뉴스 클러스터링

문제 https://programmers.co.kr/learn/courses/30/lessons/17677 코딩테스트 연습 - [1차] 뉴스 클러스터링 뉴스 클러스터링 여러 언론사에서 쏟아지는 뉴스, 특히 속보성 뉴스를 보면 비슷비슷한 제목의 기사가 많아 정작 필요한 기사를 찾기가 어렵다. Daum 뉴스의 개발 업무를 맡게 된 신입사원 튜브 programmers.co.kr 내 풀이 import java.util.*; import java.util.Map.Entry; class Solution { public int solution(String str1, String str2) { int answer = 0; str1 = str1.toLowerCase(); str2 = str2.toLowerCase(); ..