728x90 Android/Kotlin4 코틀린 공부 강의 coursera - kotlin for java developer https://www.coursera.org/learn/kotlin-for-java-developers Kotlin for Java Developers | Coursera Learn Kotlin for Java Developers from JetBrains. The Kotlin programming language is a modern language that gives you more power for your everyday tasks. Kotlin is concise, safe, pragmatic, and focused on interoperability with Java code. It can be ... www.courser.. 2019. 11. 18. [cousera] Kotlin Week3 Taxi Driver 1. 한번도 운전 못한 택시기사 찾기 -> filterNot 함수를 이용하여 Trip한 driver 들을 제외시켰다. /* * Task #1. Find all the drivers who performed no trips. */ fun TaxiPark.findFakeDrivers(): Set = this.allDrivers.filterNot { this.trips.map{trip -> trip.driver }.contains(it) }.toSet() 2. minTrips번 만큼 Trip한 승객 찾기 -> Trip에서 승객 count하여 minTrips수보다 큰경우를 구한다. /* * Task #2. Find all the clients who completed at least the given numbe.. 2019. 11. 11. [cousera] Kotlin Week3 Nice String fun String.isNice(): Boolean { var trueCondition = 0 var subString = listOf(Pair('b','u'),Pair('b','a'),Pair('b','e')) var vowels = listOf('a','e','i','o','u') var twoCharOfString = this.zipWithNext() // First Condition if ( twoCharOfString.filter { subString.contains(it) }.count() == 0) trueCondition++ // Second Condition if(this.filter{ vowels.contains(it) }.count() >= 3) trueCondition++ // Th.. 2019. 11. 11. [coursera] Kotlin for Java Developers : week2 Assignment 2주차 과제.. Mastermind game 함수형 언어 적응 까진 아직 먼 것 같다. data class Evaluation(val rightPosition: Int, val wrongPosition: Int) fun evaluateGuess(secret: String, guess: String): Evaluation { var rightPosition = 0 var wrongPosition = 0 var compareSecret = secret var compareGuess = guess for((idx, value) in guess.withIndex()){ when(value){ //일치하는 경우 secret[idx] -> { rightPosition++ compareGuess = compareGu.. 2019. 10. 5. 이전 1 다음 728x90