title: Maximum Games Played Winner
signature: class Solution {
  
      public Integer maximumGamesPlayedWinner(Integer n) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(73, 8);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(28, 6);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(33, 6);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(23, 6);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(84, 8);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(31, 6);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(48, 7);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(46, 7);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(45, 7);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(90, 9);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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 );
  }