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


Groups > comp.programming > #10696

Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post)

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.programming
Subject Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post)
Date 2020-02-27 21:06 +0000
Organization A noiseless patient Spider
Message-ID <87a753viy4.fsf@bsb.me.uk> (permalink)
References <0b8d1b58-3651-47ed-a2b8-63dc1d659c91@googlegroups.com>

Show all headers | View raw


"Chad Altenburg, Ph.D." <cdalten@gmail.com> writes:

> https://codingbat.com/prob/p180759 
>
> And here is the problem statement... 
>
> Look for patterns like "zip" and "zap" in the string -- length-3,
> starting with 'z' and ending with 'p'. Return a string where for all
> such words, the middle letter is gone, so "zipXzap" yields "zpXzp".
>
> zipZap("zipXzap") → "zpXzp" 
> zipZap("zopzop") → "zpzp" 
> zipZap("zzzopzop") → "zzzpzp"

There's are some interesting corner cases.  What about

  zipZap("zipp") → "zpp" or "zp"?

And if "overlapping" zXp strings like this are to be ignored, the
problem statement is not clear about

  zipZap("zzpp") → "zpp" or "zzp"?

You get different result from forward and reverse scans.

-- 
Ben.

Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Coding while drunk and stoned take 2. (Yes, I know this is a cross post) "Chad Altenburg, Ph.D." <cdalten@gmail.com> - 2020-02-27 06:04 -0800
  Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post) Julio Di Egidio <julio@diegidio.name> - 2020-02-27 07:24 -0800
  Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-27 15:55 +0000
    Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post) Julio Di Egidio <julio@diegidio.name> - 2020-02-27 08:06 -0800
      Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-27 21:00 +0000
        Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post) "Chad Altenburg, Ph.D." <cdalten@gmail.com> - 2020-02-27 15:18 -0800
  Re: Coding while drunk and stoned take 2. (Yes, I know this is a cross post) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-02-27 21:06 +0000

csiph-web