일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- back-end
- 코틀린
- 네트워크
- 알고리즘
- 프로젝트
- 백준
- programmers
- TDD
- 모던자바
- OS
- Brute-force
- 운영체제
- Spring
- 스프링
- 백트래킹
- Java8
- baekjoon
- 자료구조
- DP
- 그래프
- BFS
- java
- LEVEL2
- 프로그래머스
- 자바
- DFS
- algorithm
- lambda
- kotlin
- backtracking
- Today
- Total
목록알고리즘(Kotlin) (20)
요깨비's LAB
import java.util.* var energyBalls = mutableListOf() var N: Int = 0 var max = Int.MIN_VALUE fun main() { val scr = Scanner(System.`in`) N = scr.nextInt() for (i in 0 until N) { val element = scr.nextInt() energyBalls.add(element) } doAlgorithm(0, 0, N) println(max) } fun doAlgorithm(count: Int, value: Int, size: Int) { if (energyBalls.size == 2) { max = if (max < value) value else max return } f..
import java.util.* var N = 0 var max = Int.MIN_VALUE var min = Int.MAX_VALUE val elements = mutableListOf() val operators = mutableListOf() fun main() { val scr = Scanner(System.`in`) N = scr.nextInt() for (i in 0 until N) { val element = scr.nextInt() elements.add(element) } for (i in 0 until 4) { val operator = scr.nextInt() operators.add(operator) } doAlgorithm(1, elements[0]) println(max) pr..
import java.util.* var k = 0 var inEqualitySigns: Array? = null var visited: Array? = null var results = mutableListOf() fun main() { val scr = Scanner(System.`in`) k = scr.nextInt() visited = Array(10) { false } inEqualitySigns = Array(k) { "" } for (i in 0 until k) { val element = scr.next() inEqualitySigns!![i] = element } doAlgorithm(0, "", -1) results.sort() println(results[results.size-1])..
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..