Squaring Off (fit to smallest possible square) Intro
More complex than A square of text since this requires padding and input has unknown data type.
Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic code-golf edition of this year's tenth problem.
I have explicit permission to post this challenge here from the original author of the competition. Feel free to verify by following the provided link and contacting the author.
Problem
Write a program/function that will reshape a given string or numeric list into the smallest square that will contain all the elements of the input, padding with additional elements if necessary. The pad element should be the default fill element for the given data type, or any one element of your choice. The elements of the square should be in such order that flattening it will give the original order of input data (with trailing padding elements, if any).
Test cases
[1,2,3,4] →
[[1,2],
 [3,4]]


[1,2,3,4,5] →
[[1,2,3],
 [4,5,0],
 [0,0,0]]


&quot;Dyalog APL&quot; →
[[&quot;Dyal&quot;],       [[&quot;D&quot;,&quot;y&quot;,&quot;a&quot;,&quot;l&quot;],
 [&quot;og A&quot;],   or   [&quot;o&quot;,&quot;g&quot;,&quot; &quot;,&quot;A&quot;],
 [&quot;PL  &quot;],        [&quot;P&quot;,&quot;L&quot;,&quot; &quot;,&quot; &quot;],
 [&quot;    &quot;]]        [&quot; &quot;,&quot; &quot;,&quot; &quot;,&quot; &quot;]]


[100] →
[[100]]


[] →
your language's closest equivalent to an empty matrix, e.g. [] or [[]]
MATL, 12 9 bytes

Saved three bytes thanks to Luis. he instead of UGwewe, but adding a t in the beginning. 

tnX^Xkthe


Try it online!

This returns the results, but transposed compared to the result in OPs post (which is OK). 

Explanation:

This works the same way for both numeric and string input, as MATL treats them the same way.

Assume the input is 'Dyalog APL'

                % Implicit: Take string or numeric array as input
                % Stack: 'Dyalog APL'
t               % Duplicate
                % Stack: 'Dyalog APL'
                %        'Dyalog APL'
 n              % Number of elements in last element. 
                % Stack: 'Dyalog APL'
                %        10
  X^            % Take the square root of the number of elements
                % Stack: 'Dyalog APL'
                % Stack: 3.16...
    Xk          % Ceil last number
                % Stack: 'Dyalog APL'
                %        4
      t         % Duplicate element
                % Stack: 'Dyalog APL'
                %        4
                %        4
       h        % Concatenate the last to elements horizontally
                % Stack: 'Dyalog APL'
                %        4  4
        e       % reshape into 4 rows, and 4 columns. Pads the input with zeros or spaces
                % if necessary.
                % Stack: (Note that there's a trailing column not shown below)
                %        DoP 
                %        ygL 
                %        a   
                %        lA  


This outputs nothing for empty input, which happens to be way MATL outputs empty matrices / strings.