Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29293

Re: A question about a solution from codingbat.com

From thinbluernime <thinbluernime3@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: A question about a solution from codingbat.com
Date 2014-07-25 03:52 +0000
Organization Aioe.org NNTP Server
Message-ID <lqsk93$2bo$1@speranza.aioe.org> (permalink)
References <07898d55-9606-44a7-8298-8f5f1c9094c6@googlegroups.com> <53d1a920$0$291$14726298@news.sunsite.dk> <da5efc57-5188-427b-988b-7975d28e7c3f@googlegroups.com>

Show all headers | View raw


On Thu, 24 Jul 2014 18:39:12 -0700, cdalten wrote:

> I don't think your code and his code are doing exactly the same. I would
> expect different results from "axbxxc".
> 
> Why does this produce different results?

This version shouldn't:

boolean doubleX(String str) {
  for(int i = 0; i < str.length() - 1; i++) {
     if(str.charAt(i) == 'x'){
         return str.charAt(i+1) == 'x';
     }
  }//end for
  return false;
}

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A question about a solution from codingbat.com cdalten@gmail.com - 2014-07-24 17:26 -0700
  Re: A question about a solution from codingbat.com Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 20:47 -0400
    Re: A question about a solution from codingbat.com cdalten@gmail.com - 2014-07-24 18:39 -0700
      Re: A question about a solution from codingbat.com Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 21:43 -0400
      Re: A question about a solution from codingbat.com thinbluernime <thinbluernime3@gmail.com> - 2014-07-25 03:52 +0000
  Re: A question about a solution from codingbat.com Joerg Meier <joergmmeier@arcor.de> - 2014-07-25 08:05 +0200
    Re: A question about a solution from codingbat.com Leif Roar Moldskred <leifm@huldreskog.lan> - 2014-07-25 01:19 -0500
  Re: A question about a solution from codingbat.com rossano.basile@tiscali.it (Rossano Basile) - 2014-07-26 10:05 +0200
    Re: A question about a solution from codingbat.com Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2014-07-27 23:02 +0000

csiph-web