title: Find N Th Element From Sterns Diatomic Series
signature: function findNThElementFromSternsDiatomicSeries(n) {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value) {
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual, expected){
      return convertToString(actual)===convertToString(expected);
  }
  
  function driver(n, expected){
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(37, 11);
    console.log(`TEST-0...${result}`);
  
    result = driver(24, 2);
    console.log(`TEST-1...${result}`);
  
    result = driver(13, 5);
    console.log(`TEST-2...${result}`);
  
    result = driver(56, 3);
    console.log(`TEST-3...${result}`);
  
    result = driver(26, 5);
    console.log(`TEST-4...${result}`);
  
    result = driver(67, 11);
    console.log(`TEST-5...${result}`);
  
    result = driver(82, 11);
    console.log(`TEST-6...${result}`);
  
    result = driver(60, 4);
    console.log(`TEST-7...${result}`);
  
    result = driver(64, 1);
    console.log(`TEST-8...${result}`);
  
    result = driver(65, 7);
    console.log(`TEST-9...${result}`);
  
    process.exit(0);
  };
  
  if (require.main === module) {
    main();
  }
source_py: def find_n_th_element_from_sterns_diatomic_series(n):
      DP = ([0] * (n + 1))
      DP[0] = 0
      DP[1] = 1
      for i in range(2, (n + 1)):
          if (int((i % 2)) == 0):
              DP[i] = DP[int((i / 2))]
          else:
              DP[i] = (DP[int(((i - 1) / 2))] + DP[int(((i + 1) / 2))])
      return DP[n]
source_cpp: int find_n_th_element_from_sterns_diatomic_series(int n) {
    int DP [ n + 1 ];
    DP [ 0 ] = 0;
    DP [ 1 ] = 1;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      if ( i % 2 == 0 ) DP [ i ] = DP [ i / 2 ];
      else DP [ i ] = DP [ ( i - 1 ) / 2 ] + DP [ ( i + 1 ) / 2 ];
    }
    return DP [ n ];
  }