Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Ignore me i've read it wrong

  • Default User Avatar
  • Default User Avatar

    There is an error in the first sample test, should be asking for Hello world, not Hello World.

  • Default User Avatar

    Typical.. I put 'y' instead of 'o' as the question specifies haha, thanks anyway

  • Default User Avatar

    I am doing the XO Kata and I dont know why this doesnt return true for the string xoxo I understand why it wont work for capital letters, I havent implemented that yet:

    public static boolean getXO (String str) {
     
      boolean state=false;
      int countx = 0;
      int county = 0;
     if(!str.contains("x") & !str.contains("o") ){
        state = true;
      
      }   
    
      for(int i=0;i<str.length();i++){
        if(str.charAt(i)=='x' ){
        countx +=1;
        
        }
        else if(str.charAt(i)=='y'){
        county +=1;
        }
      }
      if(countx==county){
      System.out.println(countx);
      state=true;
        
      }
      
     return state;
    }