This file contains hidden or 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
/** | |
* Если слова анаграммы, то у них одинаковое количество всех букв | |
* (то есть в обоих словах 2 буквы а, одна буква р, нет буквы к, и тд). | |
* Во втором слове можно запомнить индексы соответствующих букв, | |
* и найти эти же конкретные буквы в первом слове. | |
* Например слова АААААББДКРР АБРАКАДАБРА, тогда массив из чисел, | |
* который показывает на каком месте буква из первого слова | |
* расположена во втором, будет выглядеть так: | |
* 0,3,5,7,10,1,9,6,4,2,8. | |
* Если непонятно зачем это нужно, то сейчас поясню |
This file contains hidden or 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
data class Variant(val step: Int, val Nheads: Int, val Mtails: Int, val comment: String = "", val prev: Variant? = null) | |
fun main(args: Array<String>) { | |
val variants = mutableListOf<Variant>() | |
variants.add(Variant(step = 0, Nheads = 3, Mtails = 1)) | |
var i = 0 | |
val max = 10 | |
var result: Variant? = null | |
val isSwordBroken = true |
This file contains hidden or 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
import com.google.gson.JsonObject | |
fun main(args: Array<String>) { | |
val json = JsonObject() | |
json.commit { | |
addProperty("added_property", "This is the added property") | |
} | |
json.commit { | |
remove("added_property") |
NewerOlder