+ 2
Why log2 gives unresolved reference in Sololearn?
Sololearn gives unresolved reference when I am importing kotlin.math library and when using the function log2(). In IntelliJ it works fine. Is this a problem in Sololearn? https://code.sololearn.com/cfzQUhnK1jo7/?ref=app
2 Answers
+ 4
log2 was added in version 1.2. SoloLearn is still using 1.1. This should calculate it for you:
fun log2(n: Double) =
Math.log(n)/Math.log(2.0)
+ 3
I had to use that formula only. Thanks sir.