Skip to content

Instantly share code, notes, and snippets.

View cyrilnoah1's full-sized avatar
🦍
Undergoing biological evolution.

B R Cyril Noah cyrilnoah1

🦍
Undergoing biological evolution.
View GitHub Profile
@cyrilnoah1
cyrilnoah1 / DS_ALGO_Strings_003.kt
Last active November 28, 2019 03:27
Maximum and minimum sums from two numbers with digit replacements
import kotlin.system.*
import kotlin.contracts.*
import java.util.*
fun main() {
fun printMinAndMax(x1: Int, x2: Int, maxDigit: Int, minDigit: Int){
val s1 = x1.toString()
val s2 = x2.toString()
@cyrilnoah1
cyrilnoah1 / DS_ALGO_Strings_002.kt
Last active November 28, 2019 03:27
Minimum sum of squares of cha.racter counts in a given string after removing k characters
import kotlin.system.*
import kotlin.contracts.*
import java.util.*
fun main() {
print(MinCharSquareSum().getResult("aabaa", 0))
}
class MinCharSquareSum {
@cyrilnoah1
cyrilnoah1 / DS_ALGO_Strings_001.kt
Created November 26, 2019 04:19
Smallest number with sum of digits as N and divisible by 10^N.
import kotlin.system.*
import kotlin.contracts.*
fun main() {
fun minValue(n : Int){
fun printZeros(){
print("0")
}
@cyrilnoah1
cyrilnoah1 / DS_ALGO_Arrays_001.kt
Last active November 26, 2019 03:58
Find duplicates in an array where an index K is provided such that each window size with indices I and J satisfy abs(J - I) <= K.
import kotlin.system.*
fun main() {
val l = mutableListOf<Int>()
for(i in 1..23){
l.add(i)
}