• [Lessons1]BinaryGap

    문제 https://app.codility.com/programmers/lessons/1-iterations/binary_gap/ 풀이 public class Solution { public int solution(int N) { // write your code in Java SE 8 boolean flag = false; int biggerNum = 0; int tempNum = 0; String binaryStr = Integer.toBinaryString(N); char[] binaryArray = binaryStr.toCharArray(); for(char ch : binaryArray){ if('1' == ch){ if(tempNum > 0){...


  • [1차]비밀지도

    문제 https://www.welcomekakao.com/learn/courses/30/lessons/17681 풀이 class Solution { public String[] solution(int n, int[] arr1, int[] arr2) { String[] answer = new String[n]; for(int i=0; i<n; ++i){ int tempNum = arr1[i]|arr2[i]; String tempBinary = Integer.toBinaryString(tempNum); int tempLength = tempBinary.length(); if(tempLength < n){ for(int j=0; j<n-tempLength; ++j){ tempBinary = "0"+tempBinary; } } answer[i] =...


  • [1차]다트 게임

    문제 https://www.welcomekakao.com/learn/courses/30/lessons/17682 풀이 class Solution { public int solution(String dartResult) { int answer = 0; int[] tempArray = new int[3]; int temp = 0; int cnt = 0; char[] charArray = dartResult.toCharArray(); for(char ch : charArray){ if(Character.isDigit(ch)){ //숫자 if(temp == 1 && ch == '0'){ temp = 10; tempArray[cnt-1] =...


  • [Oracle]서브쿼리와 IN 문으로 인한 성능 저하

    사건의 발단 얼마 전까지 한창 날 괴롭히던 문제가 하나 있었다. 유지보수를 맡고 있는 시스템이 하나 있는데 언제부턴가 자꾸 Java Application 단과 DB 사이의 커넥션이 날아가버리는 현상이 발생하는 것이었다. 몇 년 동안 잘 운영되던 시스템이었고 최근 몇 달은 특별히 작업한 부분도 없었다. 대충 로그를 살펴보니 아래와 같은 로그가 계속 보였다. java.sql.SQLRecoverableException:...


  • [Java]ResultSet 사용 시 CLOB 타입을 처리하지 못하는 오류

    ResultSet 사용 시 CLOB 타입을 처리하지 못하는 오류 Spring에선 사실상 볼 일이 거의 없는 ResultSet. 하지만 Spring 이전 Framework에선 아주 많이 쓰인다. 나도 현업에서 매일 같이 쓰고 있기 때문에 빼놓을 수 없는 녀석인데 오늘 ResultSet을 이용하여 DB에서 빼온 데이터를 VO 객체에 담으려고 하였더니 오류가 났었다. java.sql.SQLException: Conversion to String failed...