Skip to main content
Commonmark migration
Source Link

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

Explanation

The second and third outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

The second and third outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

Explanation

The second and third outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

added 10 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

The second and third outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

The second outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

The second and third outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

added 121 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

The second and third outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

The second and third outputs of mode respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input. The cell array c is then repeated horizontally b times and contatenated horizontally to give a numeric matrix.

Octave, 47 bytes

[~,b,c]=mode(input(0));disp([repmat(c,1,b){:}])

Try it online!

###Explanation

The second outputs of mode (obtained as [~,b,c]=mode(...)) respectively give the number of repetitions (b) and a column cell array (c) of the most repeated elements in the input (input(0)) . The cell array c is then repeated horizontally b times (repmat(c,1,b)), converted to a comma-separated list ({:}) and contatenated horizontally ([...]) to give a numeric matrix, which is displayed (disp(...)).

Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading