일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Spring
- 자바
- DP
- TDD
- Java8
- 코틀린
- 네트워크
- back-end
- DFS
- OS
- 운영체제
- 모던자바
- 스프링
- kotlin
- 자료구조
- 프로젝트
- programmers
- LEVEL2
- 알고리즘
- BFS
- 백트래킹
- 그래프
- java
- Brute-force
- 백준
- baekjoon
- backtracking
- 프로그래머스
- lambda
- Today
- Total
목록algorithm (41)
요깨비's LAB
import java.util.* import kotlin.math.abs var max = Int.MIN_VALUE val visited = mutableListOf() var N = 0 fun main() { val scr = Scanner(System.`in`) val arr = mutableListOf() N = scr.nextInt() for(i in 0 until N) { val element = scr.nextInt() arr.add(element) visited.add(false) } for(i in 0 until N) { visited[i] = true getMax(1,i, arr, 0) visited[i] = false } println(max) } fun getMax(current:I..
말 그대로 아래 설명대로 구현하면 되는 문제였습니다. 따로 설명은 필요없을 것 같습니다. import java.util.* class Solution { fun solution(p: String): String { var answer = "" answer = doAlgorithm(p) return answer } fun doAlgorithm(p: String): String { var str = "" if (p == "") return "" var index = divideString(p) var u = getU(p, index) var v = getV(p, index) // println("u=$u v=$v") if(checkIsCorrectString(u)) { str += u str += doAlg..
import java.util.* var isComplete = false class ZeroArea( var row: Int, var col: Int, var visited: Array = Array(9) { false } ) val map = Array(9) { Array(9) { 0 } } fun main() { val scr = Scanner(System.`in`) val zeroAreas = mutableListOf() for (i in 0 until 9) { for (j in 0 until 9) { map[i][j] = scr.nextInt() if (map[i][j] == 0) { zeroAreas.add(ZeroArea(i, j)) } } } for (zeroArea in zeroAreas..
import java.util.* class Solution { fun solution(s: String): Int { var answer = Int.MAX_VALUE var strLen = s.length var compactIndex = strLen / 2 var compareStr = s.substring(compactIndex, strLen) for (i in 1..compactIndex) { var resultStr = "" var index = 0 while (index strLen) break; compareStr = s.substring(index, index + i) } if (count > 1) { subStr = StringBuffer().append(count).append(subS..
class Solution { fun solution(w: Int, h: Int): Long { var answer: Long = 0 var w = w.toLong() var h = h.toLong() val gcd = getGcd(w,h) answer = ((w*h) - (w+h-gcd)) return answer } fun getGcd(num1: Long, num2: Long):Long { var n1: Long var n2: Long var gcd:Long = 1 if(num1 >= num2) { n1 = num1 n2 = num2 } else { n1 = num2 n2 = num1 } for(i in 1..n2) { if(n1 % i == 0.toLong() && n2 % i == 0.toLong..
import java.util.* var N: Int = 0 var M: Int = 0 val sb = StringBuffer() fun main() { val scr = Scanner(System.`in`) N = scr.nextInt() M = scr.nextInt() for(i in 1..N) { val str = StringBuffer() dfs(i, str.append(i).append(" "), 1) } print(sb.toString()) } fun dfs(n:Int, str: StringBuffer,count: Int) { if(count == M) { sb.append(str.toString() + "\n") return } val n = n+1 for(i in n..N) { var s ..
class Solution { fun solution(new_id: String): String { var answer: String = new_id answer = step1(answer) answer = step2(answer) answer = step3(answer) answer = step4(answer) answer = step5(answer) answer = step6(answer) answer = step7(answer) return answer } fun step1(new_id: String): String { return new_id.toLowerCase() } fun step2(new_id: String): String { val sb = StringBuffer() new_id.forE..
import java.util.* class Solution { var result:Int = 0 fun solution(board: Array, moves: IntArray): Int { val basket = Stack() for (col in moves) { catchDoll(board, basket, col-1) } return result } private fun catchDoll(board: Array, basket: Stack, col: Int) { val rowSize = board.size-1 for(row:Int in 0..rowSize) { if(board[row][col] == 0) { continue }else { insertToBasket(basket, board[row][col..