title: Maximum Games Played Winner
signature: function maximumGamesPlayedWinner(n: number): number {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(n: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(n),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(73, 8);
    console.log(`TEST-0...${result}`);
  
    result = driver(28, 6);
    console.log(`TEST-1...${result}`);
  
    result = driver(33, 6);
    console.log(`TEST-2...${result}`);
  
    result = driver(23, 6);
    console.log(`TEST-3...${result}`);
  
    result = driver(84, 8);
    console.log(`TEST-4...${result}`);
  
    result = driver(31, 6);
    console.log(`TEST-5...${result}`);
  
    result = driver(48, 7);
    console.log(`TEST-6...${result}`);
  
    result = driver(46, 7);
    console.log(`TEST-7...${result}`);
  
    result = driver(45, 7);
    console.log(`TEST-8...${result}`);
  
    result = driver(90, 9);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
source_py: def maximum_games_played_winner(N):
      dp = [0 for i in range(N)]
      dp[0] = 1
      dp[1] = 2
      i = 1
      while (dp[i] <= N):
          i = (i + 1)
          dp[i] = (dp[(i - 1)] + dp[(i - 2)])
      return (i - 1)
source_cpp: int maximum_games_played_winner(int N) {
    int dp [ N ];
    dp [ 0 ] = 1;
    dp [ 1 ] = 2;
    int i = 2;
    do {
      dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ];
    }
    while ( dp [ i ++ ] <= N );
    return ( i - 2 );
  }