728x90
반응형

IT/알고리즘 11

substring과 유사한 String 생성자 (LeetCode 2390)

https://leetcode.com/problems/removing-stars-from-a-string/description/ Removing Stars From a String - LeetCode Can you solve this real interview question? Removing Stars From a String - You are given a string s, which contains stars *. In one operation, you can: * Choose a star in s. * Remove the closest non-star character to its left, as well as remove the star it leetcode.com stack 키워드를 보고 풀기..

IT/알고리즘 2023.09.12

[프로그래머스] 문자열 계산하기, 인덱스 바꾸

* 버클업 6월 4주차 문자열계산 https://school.programmers.co.kr/learn/courses/30/lessons/120902 class Solution { public int solution(String my_string) { String[] set = my_string.split(" "); int answer = Integer.valueOf(set[0]); for(int i=1; iint 변환해서 sum 함수로 집계 하지만 성능은 별로이다 (Runtime 1.38~1.89ms) 인덱스바꾸기 https://school.programmers.co.kr/learn/courses/30/lessons/120895 1. 생각나는대로 풀어보기 Runtime 0.13~0.20ms 소요 (다소..

IT/알고리즘 2023.06.28

[프로그래머스] 피자 나눠 먹기(3), 중앙값 구하기

* 버클업 6월 3주차 피자나눠먹기 https://school.programmers.co.kr/learn/courses/30/lessons/120816 class Solution { public int solution(int slice, int n) { for(int i=0; i= n){ return i; } } return 0; } } 총 피자조각 slice의 개수가 인원수 n보다 많기만 하면 됨... 간단한 문 중간값 찾기 https://school.programmers.co.kr/learn/courses/30/lessons/120811 import java.util.Arrays; class Solution { public int solution(int[] array) { Arrays.sort(arr..

IT/알고리즘 2023.06.21

프로그래머스 Lv.0 최댓값 만들기(2)

https://school.programmers.co.kr/learn/courses/30/lessons/120862 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr * 버클업 5월 5째주 import java.util.*; class Solution { public int solution(int[] numbers) { int answer = -100000000; for(int i=0; i

IT/알고리즘 2023.05.24

프로그래머스 Lv.1 부족한 금액 계산하기

https://school.programmers.co.kr/learn/courses/30/lessons/82612 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr * 버클업 5월 5째주 class Solution { public long solution(int price, int money, int count) { for(int i = 1; i0) { money = 0; } return Math.abs(money); } } 이렇게 했는데 테스트케이스 19~22 통과 실패함... 질문하기 탭 둘러보니 지난주 구슬문제와 마찬가지로 int 범위를 넘어선 문제로 ..

IT/알고리즘 2023.05.24
300x250
반응형