This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun max<T : Any>(list: List<T>, weight: (T) -> Int): T? { | |
return when (list.size()) { | |
0 -> null | |
1 -> list.first() | |
else -> list.reduce({ a, b -> if (weight(a) > weight(b)) a else b }) | |
} | |
} | |
fun main(args: Array<String>) { | |
println( max(listOf("a", "bcd", "ef"), { it.length() }) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Database.kt | |
*/ | |
import com.rethinkdb.RethinkDB | |
import com.rethinkdb.gen.ast.ReqlExpr | |
import com.rethinkdb.net.Connection | |
import com.rethinkdb.net.ConnectionInstance | |
object Database { | |
private lateinit var db: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name FalkeynScript | |
// @match * | |
// ==/UserScript== | |
/* jshint multistr: true */ | |
(function() { | |
var css = '\ | |
<style>\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Wtf | |
// Primitives | |
operator fun Int.plus(that: String) = "$this$that" | |
operator fun String.plus(that: Int) = "$this$that" | |
Копирайтинг: Катя Широкова
Тестирование: Максим Захаров
Системная аналитика: Юля Закс
Техническое писательство: Юля Шишканова
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var streamReader = new StreamReader("c:\\file.txt"); | |
try | |
{ | |
Console.Write(streamReader.ReadToEnd()); | |
} | |
finally | |
{ | |
if (streamReader != null) | |
streamReader.Dispose(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
class GreetingController { | |
val counter = AtomicLong() | |
@GetMapping("/greeting") | |
fun greeting(@RequestParam(value = "name", defaultValue = "World") name: String) = | |
Greeting(counter.incrementAndGet(), "Hello, $name") | |
} |
Вычислительная сложность алгоритма.
Условие: https://goo.gl/forms/taz8uD8eeMvxMDbF3
Подсказка: https://ulearn.me/Course/complexity
Дедлайн: 7 ноября в 17:00
Автор: Игорь Луканин
Быстрая фильтрация метрик.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"asd": "123" } |
OlderNewer