title: Find Index Given Fibonacci Number Constant Time
signature: def findIndexGivenFibonacciNumberConstantTime(n: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(n: Int, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        5, 
        5    
      )}")   
  
  
      println(s"TEST-1...${driver(
        19, 
        8    
      )}")   
  
  
      println(s"TEST-2...${driver(
        7, 
        6    
      )}")   
  
  
      println(s"TEST-3...${driver(
        94, 
        12    
      )}")   
  
  
      println(s"TEST-4...${driver(
        58, 
        11    
      )}")   
  
  
      println(s"TEST-5...${driver(
        65, 
        11    
      )}")   
  
  
      println(s"TEST-6...${driver(
        69, 
        11    
      )}")   
  
  
      println(s"TEST-7...${driver(
        96, 
        12    
      )}")   
  
  
      println(s"TEST-8...${driver(
        80, 
        11    
      )}")   
  
  
      println(s"TEST-9...${driver(
        14, 
        8    
      )}")   
  
  }
  
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;
  }