Skip to content

Instantly share code, notes, and snippets.

package ru.fbear.strings
class Brackets {
fun valid(bracketsString: String): Boolean {
var left = 0
var right = 0
for (sym in bracketsString) {
when (sym) {
package ru.fbear.strings
class Strings {
fun shuflled(source: String, shuffled: String): Boolean {
val sourceCharMap: MutableMap<Char, Int> = mutableMapOf()
for (char in source) {
if (!sourceCharMap.containsKey(char)) sourceCharMap[char] = 1
else sourceCharMap[char] = sourceCharMap[char]!! + 1
}
@teacons
teacons / Find.kt
Last active October 16, 2021 07:52
package ru.fbear.arithmetic
import kotlin.math.abs
class Find {
fun findNearNum(nums: List<Int>, givenNum: Int): Int {
var near = -1
var minDiff = Int.MAX_VALUE
for (num in nums) {
package ru.fbear.arithmetic
import kotlin.math.abs
fun main(args: Array<String>) {
println("Hello World!")
// Try adding program arguments at Run/Debug configuration
println("Program arguments: ${args.joinToString()}")
}