[Question]
  [
Given a list of `N` non-negative integers, output those numbers with each left-padded by spaces to a length of `N`. (Alternatively, return a character/string list.) **You may assume that `N` is greater than or equal to the number of digits of the largest number in the list.** Trailing spaces are allowed in the output.
You may also take a string containing these numbers, but `N` is not the length of the string, but rather the number of elements in the list; also, you may take a list of strings e.g. `["1", "2", "3"]`.
This is a code-golf, so the shortest program in bytes wins.
## Test cases
```
input => 'output'
0 => '0'
1 => '1'
2 3 => ' 2 3'
2 10 => ' 210'
4 5 6 => '  4  5  6'
17 19 20 => ' 17 19 20'
7 8 9 10 => '   7   8   9  10'
100 200 300 0 => ' 100 200 300   0'
1000 400 30 7 => '1000 400  30   7'
1 33 333 7777 => '   1  33 3337777'
0 0 0 0 0 0 => '     0     0     0     0     0     0'
```
  
[Answer]
## Python, 32 bytes
```
lambda l:'%%%ds'%len(l)*len(l)%l
```
An anonymous function that takes a tuple as input. Either numbers or strings work.
Example:
```
l=(1,33,333,7777)
'%%%ds'
## A "second-order" format string
'%%%ds'%len(l)           -> '%4s'
## Inserts the length as a number in place of '%d'
## The escaped '%%' becomes '%', ready to take a new format argument
## The result is a format string to pad with that many spaces on the left
'%%%ds'%len(l)*len(l)    -> '%4s%4s%4s%4s'
## Concatenates a copy per element
'%%%ds'%len(l)*len(l)%l  -> '   1  33 3337777'
## Inserts all the tuple elements into the format string 
## So, each one is padded with spaces
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 3 bytes
Code:
```
Dgj
```
Explanation:
```
D    # Duplicate the input array
 g   # Get the length 
  j  # Left-pad with spaces to the length of the array
```
[Try it online!](http://05ab1e.tryitonline.net/#code=RGdq&input=WzEwMDAsIDQwMCwgMzAsIDdd) or [Verify all test cases](http://05ab1e.tryitonline.net/#code=dnlEZ2pc&input=WzBdLCBbMV0sIFsyLCAzXSwgWzIsIDEwXSwgWzQsIDUsIDZdLCBbMTcsIDE5LCAyMF0sIFs3LCA4LCA5LCAxMF0sIFsxMDAsIDIwMCwgMzAwLCAwXSwgWzEwMDAsIDQwMCwgMzAsIDddLCBbMSwgMzMsIDMzMywgNzc3N10sIFswLCAwLCAwLCAwLCAwLCAwXQ).
[Answer]
# JavaScript (ES7), 37 bytes
```
a=>a.map(v=>v.padStart(a.length,' '))
```
Input: Array of strings  
Output: Array of strings
```
f=
  a=>a.map(v=>v.padStart(a.length,' '))
;
console.log(f(['0']))
console.log(f(['1']))
console.log(f(['2','3']))
console.log(f(['2','10']))
console.log(f(['4','5','6']))
console.log(f(['17','19','20']))
console.log(f(['7','8','9','10']))
console.log(f(['100','200','300','0']))
console.log(f(['1000','400','30','7']))
console.log(f(['1','33','333','7777']))
console.log(f(['0','0','0','0','0','0']))
```
[Answer]
## PowerShell v2+, 36 bytes
```
param($a)$a|%{"{0,$($a.count)}"-f$_}
```
Takes input `$a` as an array of `int`egers. Loops through them with `$a|%{...}`. Each iteration, uses the `-f`ormat operator with the optional [`Alignment Component`](https://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110).aspx) (based on `$a.count`) to left-pad the appropriate number of spaces. That resultant string is left on the pipeline. At end of program execution, the resulting strings are all left on the pipeline as an array.
---
### Examples
Output is newline-separated on each run, as that's the default `Write-Output` at program completion for an array.
```
PS C:\Tools\Scripts\golfing> @(0),@(1),@(2,3),@(2,10),@(4,5,6),@(17,19,20),@(7,8,9,10),@(100,200,300,0),@(1000,400,30,7),@(1,33,333,7777),@(0,0,0,0,0,0)|%{""+($_-join',')+" -> ";(.\spaced-out-numbers $_)}
0 -> 
0
1 -> 
1
2,3 -> 
 2
 3
2,10 -> 
 2
10
4,5,6 -> 
  4
  5
  6
17,19,20 -> 
 17
 19
 20
7,8,9,10 -> 
   7
   8
   9
  10
100,200,300,0 -> 
 100
 200
 300
   0
1000,400,30,7 -> 
1000
 400
  30
   7
1,33,333,7777 -> 
   1
  33
 333
7777
0,0,0,0,0,0 -> 
     0
     0
     0
     0
     0
     0
```
[Answer]
# JavaScript, 49 bytes
```
a=>a.map(n=>" ".repeat(a.length-n.length)+n)
```
Takes the arguments as a list of strings and also returns a list of strings.
Explanation:
```
a=>                                                   An unnamed function, which takes one argument, a
   a.map(n=>                               )          Do the following to each element n in a:
            " ".repeat(a.length-n.length)             Generate the spaces needed to justify the number
                                         +n           Append the number
```
[Answer]
## Perl, 26 bytes
*-4 bytes thanks to @Ton Hospel*
25 bytes of code + `-a` flag.
```
printf"%*s",~~@F,$_ for@F
```
Run with :
```
perl -ae 'printf"%*s",~~@F,$_ for@F' <<< "10 11 12"
```
(On some older version of Perl, you might need to add `-n`)
[Answer]
# Bash, 14
```
printf %$#d $@
```
Input list given at the command line.
Not much to explain here. Simply uses built-in [`printf`](http://www.unix.com/man-page/POSIX/1posix/printf/) facilities to do the necessary padding, based off the number of passed args:
* `$#` is the number of args passed
* `%<n>d` is a printf format specifier that prints an integer with up to n leading spaces
* `$@` is the list of all args passed
* The format specifier is reused for each member of `$@`.
[Ideone](https://ideone.com/PBbSpE).
[Answer]
# Vim, 19 bytes
`YPPG!{<C-F>|R%ri<CR>djVGgJ`
Takes a list of numbers one-per-line. Relies on `:set expandtab`, which is popular, but not universal.
You clearly want to use `:right` for this. The question is how to get the number of lines onto the command line. The traditional way is `:%ri<C-R>=line('$')`, but all that text is long.
The shorter, more enterprising approach is to form the command line using the normal mode `!` command. It involves some weird workarounds, expanding the file by 2 lines then removing them again, but it comes out 2 bytes shorter. And I'm kinda shocked the garbled command line I get (like `:%ri+4!`) actually works, but it does.
[Answer]
# Ruby, ~~40~~ ~~36~~ 34 bytes
```
->m{m.map{|i|$><<i.rjust(m.size)}}
```
Can be worked on more.
Call as a lambda.
Explanation:
```
->m{m.map{|i|$><<i.rjust(m.size)}}
->m{                             } # lambda taking array m
    m.map{|i|                   }  # map over array using variable i
             $><<                  # output to $> (stdout)
                 i.rjust(m.size)   # right justify i to m's length
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~7~~ 6 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
L⁶xaUU
```
Input is an array of strings. [Try it online!](http://jelly.tryitonline.net/#code=TOKBtnhhVVU&input=&args=JzEnLCczMycsJzMzMycsJzc3Nzcn) or [verify all test cases](http://jelly.tryitonline.net/#code=TOKBtnhhVVUKw4figqxZ&input=&args=WycwJ10sIFsnMSddLCBbJzInLCczJ10sIFsnMicsJzEwJ10sIFsnNCcsJzUnLCc2J10sIFsnMTcnLCcxOScsJzIwJ10sIFsnNycsJzgnLCc5JywnMTAnXSwgWycxMDAnLCcyMDAnLCczMDAnLCcwJ10sIFsnMTAwMCcsJzQwMCcsJzMwJywnNyddLCBbJzEnLCczMycsJzMzMycsJzc3NzcnXSwgWycwJywnMCcsJzAnLCcwJywnMCcsJzAnXQ).
### How it works
```
L⁶xaUU  Main link. Argument: A (array of strings)
L       Yield the l, the length of A.
 ⁶x     Repeat ' ' l times.
    U   Upend; reverse all strings in A.
   a    Perform vectorizing logical AND, replacing spaces with their corresponding
        digits and leaving spaces without corresponding digits untouched.
     U  Upend; reverse the strings in the result to restore the original order of
        its digits, moving the spaces to the left.
```
[Answer]
# Mathematica, 25 bytes
```
#~StringPadLeft~Length@#&
```
Both input and output are lists of strings.
# Explanation
```
Length@#
```
Get the length of the input (number of element).
```
#~StringPadLeft~...
```
Pad left each element in the input so that their lengths match the length of the input.
[Answer]
# JavaScript (ES6), 47
Anonymous function, input: array of strings, output: array of strings  
Using a recursive padding function
```
a=>a.map(x=>p(x),p=x=>x[a.length-1]?x:p(' '+x))
```
For an integer/string array as input, 49 bytes:
```
a=>a.map(x=>p(x),p=x=>(y=' '+x)[a.length]?x:p(y))
```
**Test**
```
f=
a=>a.map(x=>p(x),p=x=>x[a.length-1]?x:p(' '+x))
function update() {
  var l=I.value.match(/\d+/g)||[]
  O.textContent = f(l)
}
update()
 
```
```
<input id=I oninput='update()' value='1000,400,30,7'>
<pre id=O></pre>
```
[Answer]
# PHP, 55 Bytes
```
<?foreach($a=$_GET[a]as$i)printf("%".count($a)."s",$i);
```
Pevious Version 59 Bytes
```
<?foreach($a=$_GET[a]as$i)echo str_pad($i,count($a)," ",0);
```
[Answer]
# J, 4 bytes
```
":~#
```
[**Try it online!**](https://tio.run/##XY2xDsJADEN3f4VVhm6n5K70KAiJP2EAqpYBBpj59eAidSGJl6fYvkeMx8Rm/9nE7TI9OdLNmCXDHyhSZys@NemQzpmv93V@tG0YHFm/6LhlD6/0QTZU7jgsXDE/v3JY4SxFV1g1UNu6iC8)
Unary function taking the list of numbers on the right as an array and returning the padded string.
Here it is in use at the REPL. Note that input lines are indented three spaces.
```
   f=: ":~#
   f 2 3
 2 3
   f 2 10
 210
   f 1111 222 33 4
1111 222  33   4
```
[Answer]
## [CJam](http://sourceforge.net/projects/cjam/), 11 bytes
```
lS%_,f{Se[}
```
[Try it online!](http://cjam.tryitonline.net/#code=cU4vezpMOwoKTFMlXyxme1NlW30KCl1ufS8&input=MAoxCjIgMwoyIDEwCjQgNSA2CjE3IDE5IDIwCjcgOCA5IDEwCjEwMCAyMDAgMzAwIDAKMTAwMCA0MDAgMzAgNwoxIDMzIDMzMyA3Nzc3CjAgMCAwIDAgMCAw) (As a test suite.)
### Explanation
```
l      e# Read input.
S%     e# Split around spaces.
_,     e# Copy and get length.
f{     e# Map this block over the list, passing in the length on each iteration.
  Se[  e#   Left-pad to the given length with spaces.
}
```
[Answer]
# Kotlin, 90 bytes
Golfed:
```
fun main(a:Array<String>){a.forEach{b->for(i in 1..a.size-b.length){print(" ")};print(b)}}
```
Ungolfed:
```
fun main(a: Array<String>) {
    a.forEach { b ->
        for (i in 1..a.size - b.length) {
            print(" ")
        }
        print(b)
    }
}
```
[Answer]
# Haskell, 47 bytes
```
k=length
f l=map(\s->replicate(k l-k s)' '++s)l
```
That’s a function from a list of strings to a list of strings, like the JavaScript answers. `replicate` allows one to get a list (Haskell strings are lists of characters) of a given size, so I use it — and the bolded assumption in the problem — to generate the padding (its length is `N` − <length of element>, for each element of the input list). I would have preferred to use a `printf` based solution rather than this one with `replicate` (it would have been shorter, for one thing) but the import statement kills any savings done on the function itself.
[Answer]
# Java, ~~83~~ 82 bytes
```
a->{String s="";for(int i=a.length,j=i;i-->0;)s+="%"+j+"s";return s.format(s,a);};
```
Constructs a format string designed to pad the given arguments by a number of spaces equal to the length of the array. The format string is used as an argument for `String.format`, and the result is then returned. The functional interface can accept either a `String[]` or an `Integer[]` or similar.
Full class:
```
public class Test {
    public static void main(String[] args) {
        java.util.function.Function<Integer[], String> f = a -> {
            String s = "";
            for (int i = a.length, j = i; i-- > 0;)
                s += "%" + j + "s";
            return s.format(s, a);
        };
        System.out.println(f.apply(new Integer[] {0}));
        System.out.println(f.apply(new Integer[] {2, 10}));
        System.out.println(f.apply(new Integer[] {7, 8, 9, 10}));
        System.out.println(f.apply(new Integer[] {1, 33, 333, 7777}));
        System.out.println(f.apply(new Integer[] {0, 0, 0, 0, 0, 0}));
    }
}
```
[Try it on Ideone.](http://ideone.com/xgiIU8)
*-1 byte thanks to @KevinCruijssen.*
[Answer]
# Groovy, 36 Bytes
```
{a->a.collect{it.padLeft(a.size())}}
```
Takes in array of strings only, outputs array of padded strings.
[Answer]
# JavaScript 33 bytes
similar to @Hedi - but the default padding is ' ', so its 4 chars less
```
a=>a.map(s=>s.padStart(a.length))
```
```
f=a=>a.map(s=>s.padStart(a.length))
console.log(f(["0"]))
console.log(f(["1"]))
console.log(f(["2","3"]))
console.log(f(["2","10"]))
console.log(f(["17" ,"19" ,"2"]))
console.log(f(["1000" ,"400" ,"30" ,"7"]))
```
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), 11 bytes
**Solution:**
```
,/(-#x)$$x:
```
[Try it online!](https://tio.run/##y9bNz/7/X0dfQ1e5QlNFpcLKUMHYGIiMFcyB4P9/AA "K (oK) – Try It Online")
**Explanation:**
Interpretted right-to-left. Convert to string, and left-pad with length of list, then flatten:
```
,/(-#x)$$x: / the solution                      | example:
         x: / save as 'x'                       |
        $   / string                            | $10 20 30 -> "10","20","30"
       $    / pad right by left                 | 5$"abc" -> "abc  "
  (   )     / do the stuff in brackets together |
    #x      / count x                           | #10 20 30 -> 3
   -        / negate                            |
,/          / flatten (concatenate-over)        | ,/" a"," b"," c" -> " a b c"
```
[Answer]
# MATL, 14 bytes
```
'%%%dd'inYDGYD
```
Try it out at [MATL Online](https://matl.io/?code=%27%25%25%25dd%27inYDGYD&inputs=%5B100+200+300+400%5D&version=19.2.0)
This uses formatted string creation by first constructing the format string: `%(NUM)d` and then applies string formatting again using this format string and the input.
[Answer]
# Pyth - 7 bytes
Straightforward answer using padding builtin.
```
sm.[;lQ
```
[Test Suite](http://pyth.herokuapp.com/?code=sm.%5B%3BlQ&test_suite=1&test_suite_input=%5B%220%22%5D%0A%5B%224%22%2C+%225%22%2C+%226%22%5D%0A%5B%22100%22%2C+%22200%22%2C+%22300%22%2C+%220%22%5D%0A%5B%221000%22%2C+%22400%22%2C+%2230%22%2C+%227%22%5D%0A%5B%221%22%2C+%2233%22%2C+%22333%22%2C+%227777%22%5D&debug=0).
[Answer]
# C#, 39 bytes
```
s=>s.ConvertAll(c=>c.PadLeft(s.Count));
```
Takes a `List<string>` and outputs a `List<string>`.
Explanation:
```
/*Func<List<string>, List<string>> Lambda =*/ s =>
    s.ConvertAll(c =>                                // Create a new List<string> by...
        c.PadLeft(s.Count)                           // ...padding each element by 'N'
    )
;
```
Would've been a few bytes shorter to use LINQ if the import isn't counted and then returning `IEnumerable<string>` instead of a full blown list:
### C#, 35+18 = 53 bytes
```
using System.Linq;s=>s.Select(c=>c.PadLeft(s.Count));
```
[Answer]
# R, 47 bytes
```
cat(sprintf("%*.f",length(n<-scan()),n),sep="")
```
Reads input from stdin and uses C-style formating with `sprintf`. There should be some way the `cat` function is not needed but couldn't find a way to suppress the quotes on each element without it. If we only want start and end quotes we could use the slightly longer option:
```
paste0(sprintf("%*.f",length(n<-scan()),n),collapse="")
```
]