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

  • Custom User Avatar

    Explane your problem, I can't see it. 21 people done this kata and no one got a problem with first sample test.

  • Default User Avatar
  • Custom User Avatar

    In which language?

  • 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

  • Custom User Avatar

    maybe what you want is to compare srt.charAt(i) with 'o' and not 'y'?

  • 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;
    }