Guest User

A201168.gs

a guest
Apr 27th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. ##
  2. ;"4"
  3. ##
  4.  
  5. ~:N
  6. # Build up
  7. 1,](({
  8. # Array of boxed-123-avoiding arrays of length i.
  9. # Consider possible insertions of i into each array.
  10. # Since i will be the largest, we can neglect substitution by removing the largest.
  11. :A
  12. {
  13. .,:I,1/{
  14. # arr [val]
  15. .2$@/\I+*
  16. }%
  17. I@+\~
  18. }%
  19.  
  20. # Filter
  21. {
  22. # array
  23. [
  24. .({1$<-}+%
  25. 1$){1$<-}+%
  26. @0-{(}%
  27. ]
  28. # [array-least array-leftmost array-rightmost] all renumbered
  29. A-!
  30. },
  31. [3,]-
  32. }*
  33.  
  34. `#,
Advertisement
Add Comment
Please, Sign In to add comment