On 6/24/08, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> One simple way, not optimal, but not terribly bad, I think,
> for burglars anyway ...

If I add a lot of complexity, I can get a slightly shorter
list:

brgl=:4 :0
  U=. ~. x {."1 (A.&i.~ !) y
  L=. {.U
  while. 0 e. b=.U +./@E."1 L do.
    R=. U #~ -.b
    for_n. i.-x do.
      suf=. (-n){.L
      sel=. suf -:"1 n {."1 R
      if. 1 e. sel do.
        L=.L,n}.({.I.sel){R
        break.
      end.
    end.
  end.
  L
)

   $ 4 brgl 5
152

And, if I mix things up slightly, changing that first line to
  U=. (/: [EMAIL PROTECTED])~. x {."1 (A.&i.~ !) y

I can get an even shorter result:
   $ 4 brgl 5
129

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to