Jump to content

Collect and sort square numbers in ascending order from three lists: Difference between revisions

J
(J)
Line 290:
{{Out}}
<pre>[4,9,16,25,36,36,49,81,121,144,169]</pre>
 
=={{header|J}}==
There's many valid approaches here. Here's one of them:
 
<syntaxhighlight lang=J>list1=: 3 4 34 25 9 12 36 56 36
list2=: 2 8 81 169 34 55 76 49 7
list3=: 75 121 75 144 35 16 46 35
 
/:~ (#~ ] = <.&.%:) list1,list2,list3
4 9 16 25 36 36 49 81 121 144 169</syntaxhighlight>
 
=={{header|jq}}==
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.