in reply to Re: •SPOILERS Re: (OT) Interview questions -- your response?
in thread (OT) Interview questions -- your response?

Fencepost error. I think you mean:

@array[$_,-$_-1]=@array[-$_-1,$_] for 0..$#array/2;

The middle pair was swapped twice to no effect for even sized arrays, the middle element swapped with itself for odd.

After Compline,
Zaxo

  • Comment on Re: Re: •SPOILERS Re: (OT) Interview questions -- your response?
  • Download Code

Replies are listed 'Best First'.
•Re: Re: Re: •SPOILERS Re: (OT) Interview questions -- your response?
by merlyn (Sage) on Sep 03, 2002 at 19:39 UTC
    I actually did #2 the way I did to avoid a fencepost error. And it's proveably correct.

    And think of the maintenance programmer. I'd not want to maintain your code.

    -- Randal L. Schwartz, Perl hacker

Re: Re: Re: •SPOILERS Re: (OT) Interview questions -- your response?
by demerphq (Chancellor) on Sep 04, 2002 at 08:44 UTC
    Busted.

    Oh well.

    I guess I didn't get the job.

    Yves / DeMerphq
    ---
    Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)