title: Find Index Given Fibonacci Number Constant Time
signature: fun findIndexGivenFibonacciNumberConstantTime(n: Int): Int {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(5, 5)
      println("TEST-0...${result}")
      
      result = driver(19, 8)
      println("TEST-1...${result}")
      
      result = driver(7, 6)
      println("TEST-2...${result}")
      
      result = driver(94, 12)
      println("TEST-3...${result}")
      
      result = driver(58, 11)
      println("TEST-4...${result}")
      
      result = driver(65, 11)
      println("TEST-5...${result}")
      
      result = driver(69, 11)
      println("TEST-6...${result}")
      
      result = driver(96, 12)
      println("TEST-7...${result}")
      
      result = driver(80, 11)
      println("TEST-8...${result}")
      
      result = driver(14, 8)
      println("TEST-9...${result}")
      
          
  }
  
  main()
source_py: def find_index_given_fibonacci_number_constant_time(n):
      if (n <= 1):
          return n
      a = 0
      b = 1
      c = 1
      res = 1
      while (c < n):
          c = (a + b)
          res = (res + 1)
          a = b
          b = c
      return res
source_cpp: int find_index_given_fibonacci_number_constant_time(int n) {
    if ( n <= 1 ) return n;
    int a = 0, b = 1, c = 1;
    int res = 1;
    while ( c < n ) {
      c = a + b;
      res ++;
      a = b;
      b = c;
    }
    return res;
  }