title: Find Index Given Fibonacci Number Constant Time
signature: findIndexGivenFibonacciNumberConstantTime(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          5, 
          5)
      }");
  
      print("TEST-1...${driver(
          19, 
          8)
      }");
  
      print("TEST-2...${driver(
          7, 
          6)
      }");
  
      print("TEST-3...${driver(
          94, 
          12)
      }");
  
      print("TEST-4...${driver(
          58, 
          11)
      }");
  
      print("TEST-5...${driver(
          65, 
          11)
      }");
  
      print("TEST-6...${driver(
          69, 
          11)
      }");
  
      print("TEST-7...${driver(
          96, 
          12)
      }");
  
      print("TEST-8...${driver(
          80, 
          11)
      }");
  
      print("TEST-9...${driver(
          14, 
          8)
      }");
  
      return 0;
  }
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;
  }