Easy solutions
binrebin opened this issue · 1 comments
binrebin commented
// check digit frequency
private object Solution {
private fun equalDigitFrequency(i1: Int, i2: Int): Boolean {
return i1.length == i2.length && i1.toList().toSet() == i2.toList().toSet()
}
}
// return n-th element of fibanacci series
private object Solution {
private fun fibonacci(n: Int): Int {
var list = mutableListOf<Int>(0,1,1)
if (n<4) {
return list[n-1]
}
var a = 1
var b = 1
var c = 0
(4..n).forEach {
c = a+ b
a = b
b = c
}
return c
}
}
igorwojda commented
These solutions are not correct - the tests are failing.