2

Python 3, 31 bytes lambda s:3*s+f'\n{s} {s}\n'+3*s Try it online!


1

GolfScript, 15 bytes ...n\." "\.n\.. Explanation At the beginning of the program, the input is put onto the stack. Each . copies the top of stack. Each n pushes a newline onto the stack. " " pushes a space. \ swaps the top two elements. At the end of the program, the stack is output to the standard output. Try it Online


1

naz, 46 bytes 1x1f0m9a1a1o0x1r2x1v3o1f1v1o0m4a8m1o1v1o1f1v3o Strictly speaking, the above program outputs the exact byte stream required to make the square, though the top of the square will be misaligned given that the interpreter linked above always prepends output: to program output. Explanation (with 0x commands removed) 1x1f0m9a1a1o # Function 1 ...


1

05AB1E, 7 6 bytes using the canvas and compressed integers. 3IŽ9¦Λ Try it online!


1

PHP, 918 870 650 bytes [$z,$h]=json_decode($argn);$j=$h-1;$p=array_fill(0,$c=100,[0,array_chunk($z,ceil(count($z)/$h))]);$r=fn($x)=>rand(0,$x);g:foreach($p as&$s){$b=[];for($s[0]=$l=0;$l<$h;$l++){for($m=$k=0;$k<~-count($v=$s[1][$l]);)$b[$l][]=$m+=$v[$k++];$s[0]+=abs(array_sum($z)/$h-$m-$v[$k]);}for($l=0;$l<$j;){if(array_intersect($b[$l]??[],$...


1

05AB1E, 36 bytes œIδ.Œ€`ʒOË}.ΔεηO¨}üåà≠}<·'_×€€…[ÿ]J» Slow brute-force approach (already times out for the last test case on TIO), but it works. First input is the list of brick sizes and second input is the height integer. Try it online or verify a few test cases at once. Explanation: First get all possible ways to divide the list of bricks into ...


1

PowerShell, 266 bytes param($b,$h)$w=($b|%{'['+'__'*--$_+']'})+," "*--$h|sort;filter p{if($k=--$_){$k|p;0..($k-1)|%{$j=($_,0)[$_%2];$w[$j],$w[$k]=$w[$k,$j] $k|p}}else{,(-join$w-split" ")}}$w.Length|p|?{!(($x=($a=$_)|% Le*|gu).Rank-or-join(1..($x-2)|%{$a|% Ch* $_})-match']]')}|select -f 1 Try it online! This script is brute force algorithm: converts ...


Only top voted, non community-wiki answers of a minimum length are eligible