728x90
반응형

전체 글 240

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

잘 안써서 몰랐지만 유용할(수도 있는) 자바 String 함수

split String s = "abc" String[] sa = String.split("", s); // sa = ["a", "b", "c"] 스플릿은 은근 자주쓰지만 한번 넣어봄 join String[] arr = ["a", "b", "C"]; String s = String.join("", arr); // s = "abc" List sl = new ArrayList(); sl.add("aa"); sl.add("bb"); String s = String.join(", ", sl); // s = "aa, bb" 스플릿의 반대로, 나눠진 문자열들을 합쳐주는 애 이거 몰라서 매번 반복문 돌리면서 콤마 붙여준거 실화? String.valueOf(char[]) char[] ca = {'a', 'b', 'c'..

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

* 버클업 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

Spring boot와 xml 없는 mybatis 사용하기 (어노테이션 적용)

xml 없이 어노테이션으로 마이바티스 사용하기 build.gradle dependencies { ... implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2' } Mapper.java package com.thesse.mybatis.mapper; import com.thesse.dto.testDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; @Mapper public interface Map..

음악극 <百人堂 태영>

음악극이 뭘까 궁금했는데 뮤지컬 느낌이다. 그런데 배우는 단 두명 뿐. 음악은 밴드 라이브. 생각보다 신나고 예상대로 감동적이고 너무너무 멋진 공연이었다. 이렇게 작은 프로젝트로 지나가기 아까울 만큼... 대한민국 사람들 다 보여줘야 하는게 아닐까?? 그리고 노래도 너무 좋은데 남은생애동안 뇌내플레이어로만 돌릴 게 아니라 음원을 내줘야 하는 게 아닐까? 제목에서 백인당은 이태영 선생님의 호 라고 한다. 원래 '백인당중유태화(百忍堂中有泰和)' 라고 하여 백번 참는 집안에 화평이 있다는 옛 말이 있다고 한다. 그런데 이태영 선생님은 여기서 참을 인 자를 사람 인 자로 바꾸어 백 사람의 집이라는 뜻으로 호를 지었다. 여성들이 참고 참아 이뤄내는 평화를 거부하고, 여성법률상담소와 같은 곳에 백 사람이 함께 모여..

일상리뷰 2023.05.27

프로그래머스 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
반응형