| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- Algorithm
- Math.floor()
- 프로그래머스 네트워크 java
- Codility
- java 반올림
- 프로그래머스 도둑질 java
- 프로그래머스 옹알이 java
- Arrays
- Math.ceil()
- 프로그래머스 연속된 수의 합 java
- 백준 14391
- 백준 17425
- 백준 4375
- java
- 백준 16927
- 네트워크
- sort
- 백준 16935
- 코딩테스트
- 자바
- 백준 18290
- 0으로 채우기
- mysql
- 프로그래머스 숫자의 표현 java
- 백준 15661
- java 올림
- java 내림
- 백준 11723
- time complexity
- 알고리즘
- Today
- Total
목록Algorithm (94)
취미처럼
https://www.acmicpc.net/problem/4375 4375번: 1 2와 5로 나누어 떨어지지 않는 정수 n(1 ≤ n ≤ 10000)가 주어졌을 때, 1로만 이루어진 n의 배수를 찾는 프로그램을 작성하시오. www.acmicpc.net 문제를 읽어도 무슨 소리인지 알 수가 없었다. 1, 11, 111, 1111 이런 수를 찾으라는 문제 ;; 1 * 10 + 1 = 11 11 * 10 + 1 = 111 111 * 10 + 1 = 1111 이 반복으로 대충 풀었지만 범위를 벗어나서 시간초과.. 입력된 n으로 다시 나머지를 구해서 수를 줄이면서 반복한다. import java.util.*; public class Main { public static void main(String[] args)..
배열 중 같은 수로써 짝이 맞지 않는 요소를 구하는 문제 public int solution(int[] A) { int answer = 0; for (int i = 0; i < A.length; i++) { answer ^= A[i]; } return answer; } XOR 연산은 같은 수일 때 0을 리턴한다.
주어진 배열 A에서 정수 K만큼 배열의 차수를 올리되, 차수가 배열 길이 이상일 때 0부터 다시 시작한다. public static int[] solution(int[] A, int K) { int answer[] = new int[A.length]; for (int i = 0; i < A.length; i++) { answer[(i + K) % A.length] = A[i]; } return answer; } int[] A = {0,3,4,2,5}; int K = 3; answer 배열의 인덱스 (0 + 3) % 5 = 3 answer[3] = A[0]; (1 + 3) % 5 = 4 answer[4] = A[1]; (2 + 3) % 5 = 0 answer[0] = A[2]; (3 + 3) % 5 = 1..
2진수의 1과 1사이의 간격 중 가장 큰 값을 찾는 문제 public static int solution(int N) { String str = Integer.toBinaryString(N); String[] arr = str.split(""); int totalGapLength = 0; int gapLength = 0; for (int i = 0; i totalGapLength) { totalGapLength = gapLength; } gapLength = 0; } else if(arr[i].equals("0")) { gapLength++; } } return totalGapLength; }