title: Find Index Given Fibonacci Number Constant Time
signature: pub fn find_index_given_fibonacci_number_constant_time(n: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(n: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        5, 
        5
      ));
      
      println!("TEST-1...{}", driver(
        19, 
        8
      ));
      
      println!("TEST-2...{}", driver(
        7, 
        6
      ));
      
      println!("TEST-3...{}", driver(
        94, 
        12
      ));
      
      println!("TEST-4...{}", driver(
        58, 
        11
      ));
      
      println!("TEST-5...{}", driver(
        65, 
        11
      ));
      
      println!("TEST-6...{}", driver(
        69, 
        11
      ));
      
      println!("TEST-7...{}", driver(
        96, 
        12
      ));
      
      println!("TEST-8...{}", driver(
        80, 
        11
      ));
      
      println!("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;
  }