Sort by

recency

|

249 Discussions

|

  • + 0 comments

    My Java solution with linear time and space complexity

    public static String gameOfStones(int n) {
            // goal: print the name of the winner
            if(n == 1) return "Second";
            
            boolean[] moves = new boolean[n + 1];
            
            moves[0] = false;
            for(int i = 1; i <= n; i++){
                boolean canWin = false;
                
                if (i >= 2 && !moves[i - 2]) canWin = true;
                if (i >= 3 && !moves[i - 3]) canWin = true;
                if (i >= 5 && !moves[i - 5]) canWin = true;
    
                moves[i] = canWin;
            }
            
            return moves[n] ? "First" : "Second";
        }
    
  • + 0 comments

    try to think with 7 divisible value(hint)

  • + 0 comments

    solved! google

  • + 0 comments

    Bitslife APK is a life simulation game offering players the chance to make decisions, explore scenarios, and shape their virtual lives. It’s engaging, fun, and full of bitlifechallenges.

  • + 0 comments

    Free Gmaes