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


Groups > comp.lang.python > #44084

Re: Confusing Algorithm

References <09f7da52-b0d6-4167-957f-d207faf33d07@googlegroups.com> <CAPTjJmpE1pxnxqkjBWeVAFpyNEcEnWU-tCTnnJnQbJpwjTpY9A@mail.gmail.com>
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Date 2013-04-22 15:57 +0100
Subject Re: Confusing Algorithm
Newsgroups comp.lang.python
Message-ID <mailman.923.1366643091.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 22 April 2013 13:56, Chris Angelico <rosuav@gmail.com> wrote:
> On Mon, Apr 22, 2013 at 10:39 PM, RBotha <r@ymond.co.za> wrote:
>> I'm facing the following problem:
>>
>> """
>> In a city of towerblocks, Spiderman can
>> “cover” all the towers by connecting the
>> first tower with a spider-thread to the top
>> of a later tower and then to a next tower
>> and then to yet another tower until he
>> reaches the end of the city. Threads are
>> straight lines and cannot intersect towers.
>> Your task is to write a program that finds
>> the minimal number of threads to cover all
>> the towers. The list of towers is given as a
>> list of single digits indicating their height.
>>
>> -Example:
>> List of towers: 1 5 3 7 2 5 2
>> Output: 4
>> """
>>
>> I'm not sure how a 'towerblock' could be defined. How square does a shape have to be to qualify as a towerblock? Any help on solving this problem?
>
> First start by clarifying the problem. My reading of this is that
> Spiderman iterates over the towers, connecting his thread from one to
> the next, but only so long as the towers get shorter:
>
>>-Example:
>>List of towers: 1 5 3 7 2 5 2
>>Output: 4
>
> First thread
> 1
> New thread
> 5-3
> New thread
> 7-2
> New thread
> 5-2
>
> There are other possible readings of the problem.

I read it differently. I thought the threads would go 1->5->7->5->2.


Oscar

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Confusing Algorithm RBotha <r@ymond.co.za> - 2013-04-22 05:39 -0700
  Re: Confusing Algorithm Chris Angelico <rosuav@gmail.com> - 2013-04-22 22:56 +1000
  Re: Confusing Algorithm Chris Angelico <rosuav@gmail.com> - 2013-04-23 01:02 +1000
  Re: Confusing Algorithm Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-22 15:57 +0100
    Re: Confusing Algorithm Christian Gollwitzer <auriocus@gmx.de> - 2013-04-22 22:33 +0200
      Re: Confusing Algorithm Ian Kelly <ian.g.kelly@gmail.com> - 2013-04-22 16:36 -0600
  Re: Confusing Algorithm DJC <djc@news.invalid> - 2013-04-22 22:38 +0100
  Re: Confusing Algorithm Tim Roberts <timr@probo.com> - 2013-04-23 23:18 -0700

csiph-web