title: Nth Non Fibonacci Number
signature: func nthNonFibonacciNumber(n int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(n int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(76, 85)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(91, 101)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(62, 71)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(65, 74)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(83, 93)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(57, 66)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(76, 85)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(6, 11)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(2, 6)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(86, 96)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def nth_non_fibonacci_number(n):
      prevPrev = 1
      prev = 2
      curr = 3
      while (n > 0):
          prevPrev = prev
          prev = curr
          curr = (prevPrev + prev)
          n = (n - ((curr - prev) - 1))
      n = (n + ((curr - prev) - 1))
      return (prev + n)
source_cpp: int nth_non_fibonacci_number(int n) {
    int prevPrev = 1, prev = 2, curr = 3;
    while ( n > 0 ) {
      prevPrev = prev;
      prev = curr;
      curr = prevPrev + prev;
      n = n - ( curr - prev - 1 );
    }
    n = n + ( curr - prev - 1 );
    return prev + n;
  }