SP1 Exercise 2 | Index << >> |
In Utopia young people spend their days as follows:
Given a random sample of Utopian ages (integers) from Provide two “completely different” solutions. f0←{¯1+{≢⍵}⌸(⍳6),0 4 6 12 15 18⍸⍵} f1←{ ⎕io←0 z←22⍴0 z[⍵]+←1 {+/z[⍵]}¨ (⍳4) (4 5) (6+⍳6) (12 13 14) (15 16 17) (18+⍳4) } a←¯1+?1e5⍴22 f0 a 17967 9119 27256 13639 13799 18220 f1 a 17967 9119 27256 13639 13799 18220 |