Arrow those variables!I used to solve code golf puzzles like you, but then I took an arrow in the kneeOutput a Dance Dance Revolution arrow chartSorting a list of strings without using any built-in sort methodSolve a reverse arrow mazePost-determined Array SortingTranspile these ES6 arrow functions!The next colourPronunciationSort™Draw some expanding arrowsGreatest common substring

Venezuelan girlfriend wants to travel the USA to be with me. What is the process?

How do I handle a potential work/personal life conflict as the manager of one of my friends?

Can I run a new neutral wire to repair a broken circuit?

Bullying boss launched a smear campaign and made me unemployable

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

How does having to sign to support someone for elections fit with having a secret ballot?

How to tell a function to use the default argument values?

Examples of smooth manifolds admitting inbetween one and a continuum of complex structures

Non-Commutative Algebra book

What do you call someone who asks many questions?

ssTTsSTtRrriinInnnnNNNIiinngg

Expand and Contract

Question about the derivation of the intensity formula of a diffraction grating

How to compactly explain secondary and tertiary characters without resorting to stereotypes?

I would say: "You are another teacher", but she is a woman and I am a man

How much of data wrangling is a data scientist's job?

How do conventional missiles fly?

How to add frame around section using titlesec?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Assassin's bullet with mercury

Can mass be shunted off into hyperspace, but the matter remains?

What method can I use to design a dungeon difficult enough that the PCs can't make it through without killing them?

Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?

Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?



Arrow those variables!


I used to solve code golf puzzles like you, but then I took an arrow in the kneeOutput a Dance Dance Revolution arrow chartSorting a list of strings without using any built-in sort methodSolve a reverse arrow mazePost-determined Array SortingTranspile these ES6 arrow functions!The next colourPronunciationSort™Draw some expanding arrowsGreatest common substring













6












$begingroup$


Challenge



Robin likes having his variables declaration in the shape of an arrow. Here's how he does it:



  • Input any number of strings

  • Order them by ascending length


  • Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best):



    5 or 4
    3 2
    1 1
    2 3
    4 5


Test Cases



Input:



bow
arrows
sheriffOfNottingham
kingRichard
maidMarian
princeJohn
sherwoodForest


Output:



sheriffOfNottingham
kingRichard
maidMarian
bow
arrows
princeJohn
sherwoodForest


Input:



a
bb
cc


Output (both are valid):



bb
a
cc

cc
a
bb


Input:



one
four
seven
fifteen


Possible output (the only other valid output is its vertical mirror):



seven
one
four
fifteen


Notes



  • The strings are in camelCase and have no numbers or special characters, only lowercase and uppercase letters.


  • The input can be anything you like: comma-separated as one string, array, ... Any I/O format is allowed.


  • Between strings with the same length, any order is accepted.









share|improve this question









New contributor




Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$











  • $begingroup$
    I feel like there was a very similar challenge before...but welcome to PPCG!
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Yeah that's what I thought after posting, there's no way it hasn't been done before. Would you be ok with me deleting it now that you've answered it?
    $endgroup$
    – Teleporting Goat
    3 hours ago











  • $begingroup$
    well I've been searching for a dupe but I'm not very good at the search...we do have a sandbox for posting challenges which can often catch things like that. I'm perfectly OK with you deleting it if you're worried about it being a dupe.
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Well it's too late, with 2 answers SE won't let me delete it. I had hoped for a better start in PPCG...
    $endgroup$
    – Teleporting Goat
    3 hours ago







  • 1




    $begingroup$
    Could you add a test case with an even number of strings?
    $endgroup$
    – Sherlock9
    2 hours ago















6












$begingroup$


Challenge



Robin likes having his variables declaration in the shape of an arrow. Here's how he does it:



  • Input any number of strings

  • Order them by ascending length


  • Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best):



    5 or 4
    3 2
    1 1
    2 3
    4 5


Test Cases



Input:



bow
arrows
sheriffOfNottingham
kingRichard
maidMarian
princeJohn
sherwoodForest


Output:



sheriffOfNottingham
kingRichard
maidMarian
bow
arrows
princeJohn
sherwoodForest


Input:



a
bb
cc


Output (both are valid):



bb
a
cc

cc
a
bb


Input:



one
four
seven
fifteen


Possible output (the only other valid output is its vertical mirror):



seven
one
four
fifteen


Notes



  • The strings are in camelCase and have no numbers or special characters, only lowercase and uppercase letters.


  • The input can be anything you like: comma-separated as one string, array, ... Any I/O format is allowed.


  • Between strings with the same length, any order is accepted.









share|improve this question









New contributor




Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$











  • $begingroup$
    I feel like there was a very similar challenge before...but welcome to PPCG!
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Yeah that's what I thought after posting, there's no way it hasn't been done before. Would you be ok with me deleting it now that you've answered it?
    $endgroup$
    – Teleporting Goat
    3 hours ago











  • $begingroup$
    well I've been searching for a dupe but I'm not very good at the search...we do have a sandbox for posting challenges which can often catch things like that. I'm perfectly OK with you deleting it if you're worried about it being a dupe.
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Well it's too late, with 2 answers SE won't let me delete it. I had hoped for a better start in PPCG...
    $endgroup$
    – Teleporting Goat
    3 hours ago







  • 1




    $begingroup$
    Could you add a test case with an even number of strings?
    $endgroup$
    – Sherlock9
    2 hours ago













6












6








6





$begingroup$


Challenge



Robin likes having his variables declaration in the shape of an arrow. Here's how he does it:



  • Input any number of strings

  • Order them by ascending length


  • Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best):



    5 or 4
    3 2
    1 1
    2 3
    4 5


Test Cases



Input:



bow
arrows
sheriffOfNottingham
kingRichard
maidMarian
princeJohn
sherwoodForest


Output:



sheriffOfNottingham
kingRichard
maidMarian
bow
arrows
princeJohn
sherwoodForest


Input:



a
bb
cc


Output (both are valid):



bb
a
cc

cc
a
bb


Input:



one
four
seven
fifteen


Possible output (the only other valid output is its vertical mirror):



seven
one
four
fifteen


Notes



  • The strings are in camelCase and have no numbers or special characters, only lowercase and uppercase letters.


  • The input can be anything you like: comma-separated as one string, array, ... Any I/O format is allowed.


  • Between strings with the same length, any order is accepted.









share|improve this question









New contributor




Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




Challenge



Robin likes having his variables declaration in the shape of an arrow. Here's how he does it:



  • Input any number of strings

  • Order them by ascending length


  • Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best):



    5 or 4
    3 2
    1 1
    2 3
    4 5


Test Cases



Input:



bow
arrows
sheriffOfNottingham
kingRichard
maidMarian
princeJohn
sherwoodForest


Output:



sheriffOfNottingham
kingRichard
maidMarian
bow
arrows
princeJohn
sherwoodForest


Input:



a
bb
cc


Output (both are valid):



bb
a
cc

cc
a
bb


Input:



one
four
seven
fifteen


Possible output (the only other valid output is its vertical mirror):



seven
one
four
fifteen


Notes



  • The strings are in camelCase and have no numbers or special characters, only lowercase and uppercase letters.


  • The input can be anything you like: comma-separated as one string, array, ... Any I/O format is allowed.


  • Between strings with the same length, any order is accepted.






code-golf string sorting






share|improve this question









New contributor




Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago







Teleporting Goat













New contributor




Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









Teleporting GoatTeleporting Goat

1313




1313




New contributor




Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Teleporting Goat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • $begingroup$
    I feel like there was a very similar challenge before...but welcome to PPCG!
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Yeah that's what I thought after posting, there's no way it hasn't been done before. Would you be ok with me deleting it now that you've answered it?
    $endgroup$
    – Teleporting Goat
    3 hours ago











  • $begingroup$
    well I've been searching for a dupe but I'm not very good at the search...we do have a sandbox for posting challenges which can often catch things like that. I'm perfectly OK with you deleting it if you're worried about it being a dupe.
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Well it's too late, with 2 answers SE won't let me delete it. I had hoped for a better start in PPCG...
    $endgroup$
    – Teleporting Goat
    3 hours ago







  • 1




    $begingroup$
    Could you add a test case with an even number of strings?
    $endgroup$
    – Sherlock9
    2 hours ago
















  • $begingroup$
    I feel like there was a very similar challenge before...but welcome to PPCG!
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Yeah that's what I thought after posting, there's no way it hasn't been done before. Would you be ok with me deleting it now that you've answered it?
    $endgroup$
    – Teleporting Goat
    3 hours ago











  • $begingroup$
    well I've been searching for a dupe but I'm not very good at the search...we do have a sandbox for posting challenges which can often catch things like that. I'm perfectly OK with you deleting it if you're worried about it being a dupe.
    $endgroup$
    – Giuseppe
    3 hours ago











  • $begingroup$
    @Giuseppe Well it's too late, with 2 answers SE won't let me delete it. I had hoped for a better start in PPCG...
    $endgroup$
    – Teleporting Goat
    3 hours ago







  • 1




    $begingroup$
    Could you add a test case with an even number of strings?
    $endgroup$
    – Sherlock9
    2 hours ago















$begingroup$
I feel like there was a very similar challenge before...but welcome to PPCG!
$endgroup$
– Giuseppe
3 hours ago





$begingroup$
I feel like there was a very similar challenge before...but welcome to PPCG!
$endgroup$
– Giuseppe
3 hours ago













$begingroup$
@Giuseppe Yeah that's what I thought after posting, there's no way it hasn't been done before. Would you be ok with me deleting it now that you've answered it?
$endgroup$
– Teleporting Goat
3 hours ago





$begingroup$
@Giuseppe Yeah that's what I thought after posting, there's no way it hasn't been done before. Would you be ok with me deleting it now that you've answered it?
$endgroup$
– Teleporting Goat
3 hours ago













$begingroup$
well I've been searching for a dupe but I'm not very good at the search...we do have a sandbox for posting challenges which can often catch things like that. I'm perfectly OK with you deleting it if you're worried about it being a dupe.
$endgroup$
– Giuseppe
3 hours ago





$begingroup$
well I've been searching for a dupe but I'm not very good at the search...we do have a sandbox for posting challenges which can often catch things like that. I'm perfectly OK with you deleting it if you're worried about it being a dupe.
$endgroup$
– Giuseppe
3 hours ago













$begingroup$
@Giuseppe Well it's too late, with 2 answers SE won't let me delete it. I had hoped for a better start in PPCG...
$endgroup$
– Teleporting Goat
3 hours ago





$begingroup$
@Giuseppe Well it's too late, with 2 answers SE won't let me delete it. I had hoped for a better start in PPCG...
$endgroup$
– Teleporting Goat
3 hours ago





1




1




$begingroup$
Could you add a test case with an even number of strings?
$endgroup$
– Sherlock9
2 hours ago




$begingroup$
Could you add a test case with an even number of strings?
$endgroup$
– Sherlock9
2 hours ago










10 Answers
10






active

oldest

votes


















3












$begingroup$


Python 2, 47 bytes





lambda l:l.sort(key=len)or l[1::2][::-1]+l[::2]


Try it online!






share|improve this answer









$endgroup$












  • $begingroup$
    You'll need to rearrange some stuff, but you can use [::-2] directly to save 5 bytes.
    $endgroup$
    – Sherlock9
    3 hours ago










  • $begingroup$
    @Sherlock9 I tried that, but then I had to check for the length, as lists with even / uneven lengths have to be handled differently.
    $endgroup$
    – ovs
    3 hours ago


















3












$begingroup$


C# (Visual C# Interactive Compiler), 89 bytes





n=>(n=n.OrderBy(x=>x.Length)).Where((a,b)=>b%2>0).Reverse().Concat(n.Where((a,b)=>b%2<1))


Try it online!






share|improve this answer









$endgroup$




















    3












    $begingroup$


    Jelly, 9 8 bytes



    LÞŒœm"-Ẏ


    Try it online!



    LÞŒœṚ;¥/


    is also 8 bytes.



    Thanks to @EriktheOutgolfer and @JonathanAllan for both offering golfs to save a byte.






    share|improve this answer











    $endgroup$












    • $begingroup$
      Nice! Clever golf: Ṛ€1¦ can become m"-.
      $endgroup$
      – Erik the Outgolfer
      1 hour ago










    • $begingroup$
      Or you could go for LÞŒœṚ;¥/
      $endgroup$
      – Jonathan Allan
      1 hour ago


















    2












    $begingroup$


    R, 63 bytes





    function(L,b=!seq(L)%%2,o=L[order(nchar(L))])c(rev(o[!b]),o[b])


    Try it online!



    Sort by string lengths, then put combine the terms at odd indices (reversed) with terms at even indices.






    share|improve this answer









    $endgroup$




















      2












      $begingroup$


      K (oK), 24 bytes



      Solution:



      x(<#:'x)(|&~w),&w:2!!#x:


      Try it online!



      Explanation:



      Generate the 6 4 2 0 1 3 5 sequence, use that to index into the ascending lengths of input, and use that to index into the original array:



      x(<#:'x)(|&~w),&w:2!!#x: / the solution
      x: / save input as x
      # / count (#) of x
      ! / range 0 to ...
      2! / modulo 2
      w: / save as w
      & / indices where true
      , / join with
      ( ) / do this together
      ~w / not (~) w
      & / indices where true
      | / reverse
      ( ) / do this together
      #:'x / count (#:) of each (') x
      < / indices to sort ascending
      x / index into x





      share|improve this answer











      $endgroup$




















        1












        $begingroup$

        APL+WIN, 31 38 bytes



        See Adams comment



        ⊃n[(⍳⍴n)~a],⌽n[a←2×⍳⌊.5×⍴n←n[⍒∊⍴¨n←⎕]]


        Try it online Courtesy of Dyalog Classic!



        Prompts for a nested vector of strings






        share|improve this answer











        $endgroup$












        • $begingroup$
          Does APL+ not have Monadic "tally" to replace ∊⍴ ?
          $endgroup$
          – Adám
          1 hour ago











        • $begingroup$
          Fails on '12' '1234' '1234' '1234' '1234' '12345678' '12345678' '12345678' '12345678'. Clearly, the result should have been '12345678' '12345678' '1234' '1234' '12' '1234' '1234' '12345678' '12345678'
          $endgroup$
          – Adám
          1 hour ago










        • $begingroup$
          @Adám My ancient version of APL+ does not have ≢. Agreed on your second comment I will take a look at it tomorrow.
          $endgroup$
          – Graham
          46 mins ago


















        0












        $begingroup$


        PHP, 144 bytes





        function($a)usort($a,function($b,$c)return strlen($b)-strlen($c););$e=[];foreach($a as$d)[array_unshift,array_push][++$i%2]($e,$d);return$e;


        Try it online!



        Sadly, PHP just doesn't have a lot of syntactic sugar to make this shorter. Submitting it anyway!






        share|improve this answer









        $endgroup$




















          0












          $begingroup$

          Javascript 79 bytes



          Takes input as an array of strings, outputs an arrow-sorted array of strings.



          f=s=>s.sort((a,b)=>a.length-b.length).reduce((m,x,i)=>i%2?[...m,x]:[x,...m],[])


          Explanation



          f = s => // take input as an array of strings s
          s.sort((a,b)=>a.length-b.length) // sort input by string length
          .reduce( // reduce
          (m,x,i)=>i%2?[...m,x]:[x,...m], // if index is even, stick string x at the end of the memo
          // array, else at the beginning
          [] // memo initialized to empty array
          )





          share|improve this answer









          $endgroup$




















            0












            $begingroup$


            PowerShell, 66 bytes





            1..($a=$args|sort l*).count|?$_%2|%$a[-$_];$x=,$a[-++$_]+$x;$x


            Try it online!



            Takes input via splatting, which manifests on TIO as separate command-line arguments. sorts on the length, stores that into $a, and constructs a range from 1 up to the count of input strings. We then pull out only the odd ones ?$_%2 and feed those into a loop |%.... Each iteration, we put the "last", then the "third from last", and so on onto the pipeline with $a[-$_]. Separately, we also accumulate into $x the "second from last", "fourth from last", etc. Out of the loop and the pipeline is flushed (so those elements are output) and then we output $x. In both instances, the default output gives us newlines between items automatically.





            share









            $endgroup$




















              -1












              $begingroup$

              Javascript 95 Bytes



              s=>s.sort((x,y)=>x.length-y.length).reduce((a,e,i)=>i%2?a.push(e):a.unshift(e);return a;,[]);





              share|improve this answer










              New contributor




              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






              $endgroup$












              • $begingroup$
                -1 s.sort() sorts the strings lexicographically, not by string length.
                $endgroup$
                – asgallant
                39 mins ago










              • $begingroup$
                Right, (x,y)=>x.length-y.length, should fix that.
                $endgroup$
                – somsom
                31 mins ago











              Your Answer





              StackExchange.ifUsing("editor", function ()
              return StackExchange.using("mathjaxEditing", function ()
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
              );
              );
              , "mathjax-editing");

              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "200"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );






              Teleporting Goat is a new contributor. Be nice, and check out our Code of Conduct.









              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182615%2farrow-those-variables%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              10 Answers
              10






              active

              oldest

              votes








              10 Answers
              10






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3












              $begingroup$


              Python 2, 47 bytes





              lambda l:l.sort(key=len)or l[1::2][::-1]+l[::2]


              Try it online!






              share|improve this answer









              $endgroup$












              • $begingroup$
                You'll need to rearrange some stuff, but you can use [::-2] directly to save 5 bytes.
                $endgroup$
                – Sherlock9
                3 hours ago










              • $begingroup$
                @Sherlock9 I tried that, but then I had to check for the length, as lists with even / uneven lengths have to be handled differently.
                $endgroup$
                – ovs
                3 hours ago















              3












              $begingroup$


              Python 2, 47 bytes





              lambda l:l.sort(key=len)or l[1::2][::-1]+l[::2]


              Try it online!






              share|improve this answer









              $endgroup$












              • $begingroup$
                You'll need to rearrange some stuff, but you can use [::-2] directly to save 5 bytes.
                $endgroup$
                – Sherlock9
                3 hours ago










              • $begingroup$
                @Sherlock9 I tried that, but then I had to check for the length, as lists with even / uneven lengths have to be handled differently.
                $endgroup$
                – ovs
                3 hours ago













              3












              3








              3





              $begingroup$


              Python 2, 47 bytes





              lambda l:l.sort(key=len)or l[1::2][::-1]+l[::2]


              Try it online!






              share|improve this answer









              $endgroup$




              Python 2, 47 bytes





              lambda l:l.sort(key=len)or l[1::2][::-1]+l[::2]


              Try it online!







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered 3 hours ago









              ovsovs

              19.4k21160




              19.4k21160











              • $begingroup$
                You'll need to rearrange some stuff, but you can use [::-2] directly to save 5 bytes.
                $endgroup$
                – Sherlock9
                3 hours ago










              • $begingroup$
                @Sherlock9 I tried that, but then I had to check for the length, as lists with even / uneven lengths have to be handled differently.
                $endgroup$
                – ovs
                3 hours ago
















              • $begingroup$
                You'll need to rearrange some stuff, but you can use [::-2] directly to save 5 bytes.
                $endgroup$
                – Sherlock9
                3 hours ago










              • $begingroup$
                @Sherlock9 I tried that, but then I had to check for the length, as lists with even / uneven lengths have to be handled differently.
                $endgroup$
                – ovs
                3 hours ago















              $begingroup$
              You'll need to rearrange some stuff, but you can use [::-2] directly to save 5 bytes.
              $endgroup$
              – Sherlock9
              3 hours ago




              $begingroup$
              You'll need to rearrange some stuff, but you can use [::-2] directly to save 5 bytes.
              $endgroup$
              – Sherlock9
              3 hours ago












              $begingroup$
              @Sherlock9 I tried that, but then I had to check for the length, as lists with even / uneven lengths have to be handled differently.
              $endgroup$
              – ovs
              3 hours ago




              $begingroup$
              @Sherlock9 I tried that, but then I had to check for the length, as lists with even / uneven lengths have to be handled differently.
              $endgroup$
              – ovs
              3 hours ago











              3












              $begingroup$


              C# (Visual C# Interactive Compiler), 89 bytes





              n=>(n=n.OrderBy(x=>x.Length)).Where((a,b)=>b%2>0).Reverse().Concat(n.Where((a,b)=>b%2<1))


              Try it online!






              share|improve this answer









              $endgroup$

















                3












                $begingroup$


                C# (Visual C# Interactive Compiler), 89 bytes





                n=>(n=n.OrderBy(x=>x.Length)).Where((a,b)=>b%2>0).Reverse().Concat(n.Where((a,b)=>b%2<1))


                Try it online!






                share|improve this answer









                $endgroup$















                  3












                  3








                  3





                  $begingroup$


                  C# (Visual C# Interactive Compiler), 89 bytes





                  n=>(n=n.OrderBy(x=>x.Length)).Where((a,b)=>b%2>0).Reverse().Concat(n.Where((a,b)=>b%2<1))


                  Try it online!






                  share|improve this answer









                  $endgroup$




                  C# (Visual C# Interactive Compiler), 89 bytes





                  n=>(n=n.OrderBy(x=>x.Length)).Where((a,b)=>b%2>0).Reverse().Concat(n.Where((a,b)=>b%2<1))


                  Try it online!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 hours ago









                  Embodiment of IgnoranceEmbodiment of Ignorance

                  2,338126




                  2,338126





















                      3












                      $begingroup$


                      Jelly, 9 8 bytes



                      LÞŒœm"-Ẏ


                      Try it online!



                      LÞŒœṚ;¥/


                      is also 8 bytes.



                      Thanks to @EriktheOutgolfer and @JonathanAllan for both offering golfs to save a byte.






                      share|improve this answer











                      $endgroup$












                      • $begingroup$
                        Nice! Clever golf: Ṛ€1¦ can become m"-.
                        $endgroup$
                        – Erik the Outgolfer
                        1 hour ago










                      • $begingroup$
                        Or you could go for LÞŒœṚ;¥/
                        $endgroup$
                        – Jonathan Allan
                        1 hour ago















                      3












                      $begingroup$


                      Jelly, 9 8 bytes



                      LÞŒœm"-Ẏ


                      Try it online!



                      LÞŒœṚ;¥/


                      is also 8 bytes.



                      Thanks to @EriktheOutgolfer and @JonathanAllan for both offering golfs to save a byte.






                      share|improve this answer











                      $endgroup$












                      • $begingroup$
                        Nice! Clever golf: Ṛ€1¦ can become m"-.
                        $endgroup$
                        – Erik the Outgolfer
                        1 hour ago










                      • $begingroup$
                        Or you could go for LÞŒœṚ;¥/
                        $endgroup$
                        – Jonathan Allan
                        1 hour ago













                      3












                      3








                      3





                      $begingroup$


                      Jelly, 9 8 bytes



                      LÞŒœm"-Ẏ


                      Try it online!



                      LÞŒœṚ;¥/


                      is also 8 bytes.



                      Thanks to @EriktheOutgolfer and @JonathanAllan for both offering golfs to save a byte.






                      share|improve this answer











                      $endgroup$




                      Jelly, 9 8 bytes



                      LÞŒœm"-Ẏ


                      Try it online!



                      LÞŒœṚ;¥/


                      is also 8 bytes.



                      Thanks to @EriktheOutgolfer and @JonathanAllan for both offering golfs to save a byte.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 1 hour ago

























                      answered 2 hours ago









                      Nick KennedyNick Kennedy

                      1,28649




                      1,28649











                      • $begingroup$
                        Nice! Clever golf: Ṛ€1¦ can become m"-.
                        $endgroup$
                        – Erik the Outgolfer
                        1 hour ago










                      • $begingroup$
                        Or you could go for LÞŒœṚ;¥/
                        $endgroup$
                        – Jonathan Allan
                        1 hour ago
















                      • $begingroup$
                        Nice! Clever golf: Ṛ€1¦ can become m"-.
                        $endgroup$
                        – Erik the Outgolfer
                        1 hour ago










                      • $begingroup$
                        Or you could go for LÞŒœṚ;¥/
                        $endgroup$
                        – Jonathan Allan
                        1 hour ago















                      $begingroup$
                      Nice! Clever golf: Ṛ€1¦ can become m"-.
                      $endgroup$
                      – Erik the Outgolfer
                      1 hour ago




                      $begingroup$
                      Nice! Clever golf: Ṛ€1¦ can become m"-.
                      $endgroup$
                      – Erik the Outgolfer
                      1 hour ago












                      $begingroup$
                      Or you could go for LÞŒœṚ;¥/
                      $endgroup$
                      – Jonathan Allan
                      1 hour ago




                      $begingroup$
                      Or you could go for LÞŒœṚ;¥/
                      $endgroup$
                      – Jonathan Allan
                      1 hour ago











                      2












                      $begingroup$


                      R, 63 bytes





                      function(L,b=!seq(L)%%2,o=L[order(nchar(L))])c(rev(o[!b]),o[b])


                      Try it online!



                      Sort by string lengths, then put combine the terms at odd indices (reversed) with terms at even indices.






                      share|improve this answer









                      $endgroup$

















                        2












                        $begingroup$


                        R, 63 bytes





                        function(L,b=!seq(L)%%2,o=L[order(nchar(L))])c(rev(o[!b]),o[b])


                        Try it online!



                        Sort by string lengths, then put combine the terms at odd indices (reversed) with terms at even indices.






                        share|improve this answer









                        $endgroup$















                          2












                          2








                          2





                          $begingroup$


                          R, 63 bytes





                          function(L,b=!seq(L)%%2,o=L[order(nchar(L))])c(rev(o[!b]),o[b])


                          Try it online!



                          Sort by string lengths, then put combine the terms at odd indices (reversed) with terms at even indices.






                          share|improve this answer









                          $endgroup$




                          R, 63 bytes





                          function(L,b=!seq(L)%%2,o=L[order(nchar(L))])c(rev(o[!b]),o[b])


                          Try it online!



                          Sort by string lengths, then put combine the terms at odd indices (reversed) with terms at even indices.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 3 hours ago









                          GiuseppeGiuseppe

                          17.4k31152




                          17.4k31152





















                              2












                              $begingroup$


                              K (oK), 24 bytes



                              Solution:



                              x(<#:'x)(|&~w),&w:2!!#x:


                              Try it online!



                              Explanation:



                              Generate the 6 4 2 0 1 3 5 sequence, use that to index into the ascending lengths of input, and use that to index into the original array:



                              x(<#:'x)(|&~w),&w:2!!#x: / the solution
                              x: / save input as x
                              # / count (#) of x
                              ! / range 0 to ...
                              2! / modulo 2
                              w: / save as w
                              & / indices where true
                              , / join with
                              ( ) / do this together
                              ~w / not (~) w
                              & / indices where true
                              | / reverse
                              ( ) / do this together
                              #:'x / count (#:) of each (') x
                              < / indices to sort ascending
                              x / index into x





                              share|improve this answer











                              $endgroup$

















                                2












                                $begingroup$


                                K (oK), 24 bytes



                                Solution:



                                x(<#:'x)(|&~w),&w:2!!#x:


                                Try it online!



                                Explanation:



                                Generate the 6 4 2 0 1 3 5 sequence, use that to index into the ascending lengths of input, and use that to index into the original array:



                                x(<#:'x)(|&~w),&w:2!!#x: / the solution
                                x: / save input as x
                                # / count (#) of x
                                ! / range 0 to ...
                                2! / modulo 2
                                w: / save as w
                                & / indices where true
                                , / join with
                                ( ) / do this together
                                ~w / not (~) w
                                & / indices where true
                                | / reverse
                                ( ) / do this together
                                #:'x / count (#:) of each (') x
                                < / indices to sort ascending
                                x / index into x





                                share|improve this answer











                                $endgroup$















                                  2












                                  2








                                  2





                                  $begingroup$


                                  K (oK), 24 bytes



                                  Solution:



                                  x(<#:'x)(|&~w),&w:2!!#x:


                                  Try it online!



                                  Explanation:



                                  Generate the 6 4 2 0 1 3 5 sequence, use that to index into the ascending lengths of input, and use that to index into the original array:



                                  x(<#:'x)(|&~w),&w:2!!#x: / the solution
                                  x: / save input as x
                                  # / count (#) of x
                                  ! / range 0 to ...
                                  2! / modulo 2
                                  w: / save as w
                                  & / indices where true
                                  , / join with
                                  ( ) / do this together
                                  ~w / not (~) w
                                  & / indices where true
                                  | / reverse
                                  ( ) / do this together
                                  #:'x / count (#:) of each (') x
                                  < / indices to sort ascending
                                  x / index into x





                                  share|improve this answer











                                  $endgroup$




                                  K (oK), 24 bytes



                                  Solution:



                                  x(<#:'x)(|&~w),&w:2!!#x:


                                  Try it online!



                                  Explanation:



                                  Generate the 6 4 2 0 1 3 5 sequence, use that to index into the ascending lengths of input, and use that to index into the original array:



                                  x(<#:'x)(|&~w),&w:2!!#x: / the solution
                                  x: / save input as x
                                  # / count (#) of x
                                  ! / range 0 to ...
                                  2! / modulo 2
                                  w: / save as w
                                  & / indices where true
                                  , / join with
                                  ( ) / do this together
                                  ~w / not (~) w
                                  & / indices where true
                                  | / reverse
                                  ( ) / do this together
                                  #:'x / count (#:) of each (') x
                                  < / indices to sort ascending
                                  x / index into x






                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited 2 hours ago

























                                  answered 2 hours ago









                                  streetsterstreetster

                                  2,614515




                                  2,614515





















                                      1












                                      $begingroup$

                                      APL+WIN, 31 38 bytes



                                      See Adams comment



                                      ⊃n[(⍳⍴n)~a],⌽n[a←2×⍳⌊.5×⍴n←n[⍒∊⍴¨n←⎕]]


                                      Try it online Courtesy of Dyalog Classic!



                                      Prompts for a nested vector of strings






                                      share|improve this answer











                                      $endgroup$












                                      • $begingroup$
                                        Does APL+ not have Monadic "tally" to replace ∊⍴ ?
                                        $endgroup$
                                        – Adám
                                        1 hour ago











                                      • $begingroup$
                                        Fails on '12' '1234' '1234' '1234' '1234' '12345678' '12345678' '12345678' '12345678'. Clearly, the result should have been '12345678' '12345678' '1234' '1234' '12' '1234' '1234' '12345678' '12345678'
                                        $endgroup$
                                        – Adám
                                        1 hour ago










                                      • $begingroup$
                                        @Adám My ancient version of APL+ does not have ≢. Agreed on your second comment I will take a look at it tomorrow.
                                        $endgroup$
                                        – Graham
                                        46 mins ago















                                      1












                                      $begingroup$

                                      APL+WIN, 31 38 bytes



                                      See Adams comment



                                      ⊃n[(⍳⍴n)~a],⌽n[a←2×⍳⌊.5×⍴n←n[⍒∊⍴¨n←⎕]]


                                      Try it online Courtesy of Dyalog Classic!



                                      Prompts for a nested vector of strings






                                      share|improve this answer











                                      $endgroup$












                                      • $begingroup$
                                        Does APL+ not have Monadic "tally" to replace ∊⍴ ?
                                        $endgroup$
                                        – Adám
                                        1 hour ago











                                      • $begingroup$
                                        Fails on '12' '1234' '1234' '1234' '1234' '12345678' '12345678' '12345678' '12345678'. Clearly, the result should have been '12345678' '12345678' '1234' '1234' '12' '1234' '1234' '12345678' '12345678'
                                        $endgroup$
                                        – Adám
                                        1 hour ago










                                      • $begingroup$
                                        @Adám My ancient version of APL+ does not have ≢. Agreed on your second comment I will take a look at it tomorrow.
                                        $endgroup$
                                        – Graham
                                        46 mins ago













                                      1












                                      1








                                      1





                                      $begingroup$

                                      APL+WIN, 31 38 bytes



                                      See Adams comment



                                      ⊃n[(⍳⍴n)~a],⌽n[a←2×⍳⌊.5×⍴n←n[⍒∊⍴¨n←⎕]]


                                      Try it online Courtesy of Dyalog Classic!



                                      Prompts for a nested vector of strings






                                      share|improve this answer











                                      $endgroup$



                                      APL+WIN, 31 38 bytes



                                      See Adams comment



                                      ⊃n[(⍳⍴n)~a],⌽n[a←2×⍳⌊.5×⍴n←n[⍒∊⍴¨n←⎕]]


                                      Try it online Courtesy of Dyalog Classic!



                                      Prompts for a nested vector of strings







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 30 mins ago

























                                      answered 1 hour ago









                                      GrahamGraham

                                      2,62678




                                      2,62678











                                      • $begingroup$
                                        Does APL+ not have Monadic "tally" to replace ∊⍴ ?
                                        $endgroup$
                                        – Adám
                                        1 hour ago











                                      • $begingroup$
                                        Fails on '12' '1234' '1234' '1234' '1234' '12345678' '12345678' '12345678' '12345678'. Clearly, the result should have been '12345678' '12345678' '1234' '1234' '12' '1234' '1234' '12345678' '12345678'
                                        $endgroup$
                                        – Adám
                                        1 hour ago










                                      • $begingroup$
                                        @Adám My ancient version of APL+ does not have ≢. Agreed on your second comment I will take a look at it tomorrow.
                                        $endgroup$
                                        – Graham
                                        46 mins ago
















                                      • $begingroup$
                                        Does APL+ not have Monadic "tally" to replace ∊⍴ ?
                                        $endgroup$
                                        – Adám
                                        1 hour ago











                                      • $begingroup$
                                        Fails on '12' '1234' '1234' '1234' '1234' '12345678' '12345678' '12345678' '12345678'. Clearly, the result should have been '12345678' '12345678' '1234' '1234' '12' '1234' '1234' '12345678' '12345678'
                                        $endgroup$
                                        – Adám
                                        1 hour ago










                                      • $begingroup$
                                        @Adám My ancient version of APL+ does not have ≢. Agreed on your second comment I will take a look at it tomorrow.
                                        $endgroup$
                                        – Graham
                                        46 mins ago















                                      $begingroup$
                                      Does APL+ not have Monadic "tally" to replace ∊⍴ ?
                                      $endgroup$
                                      – Adám
                                      1 hour ago





                                      $begingroup$
                                      Does APL+ not have Monadic "tally" to replace ∊⍴ ?
                                      $endgroup$
                                      – Adám
                                      1 hour ago













                                      $begingroup$
                                      Fails on '12' '1234' '1234' '1234' '1234' '12345678' '12345678' '12345678' '12345678'. Clearly, the result should have been '12345678' '12345678' '1234' '1234' '12' '1234' '1234' '12345678' '12345678'
                                      $endgroup$
                                      – Adám
                                      1 hour ago




                                      $begingroup$
                                      Fails on '12' '1234' '1234' '1234' '1234' '12345678' '12345678' '12345678' '12345678'. Clearly, the result should have been '12345678' '12345678' '1234' '1234' '12' '1234' '1234' '12345678' '12345678'
                                      $endgroup$
                                      – Adám
                                      1 hour ago












                                      $begingroup$
                                      @Adám My ancient version of APL+ does not have ≢. Agreed on your second comment I will take a look at it tomorrow.
                                      $endgroup$
                                      – Graham
                                      46 mins ago




                                      $begingroup$
                                      @Adám My ancient version of APL+ does not have ≢. Agreed on your second comment I will take a look at it tomorrow.
                                      $endgroup$
                                      – Graham
                                      46 mins ago











                                      0












                                      $begingroup$


                                      PHP, 144 bytes





                                      function($a)usort($a,function($b,$c)return strlen($b)-strlen($c););$e=[];foreach($a as$d)[array_unshift,array_push][++$i%2]($e,$d);return$e;


                                      Try it online!



                                      Sadly, PHP just doesn't have a lot of syntactic sugar to make this shorter. Submitting it anyway!






                                      share|improve this answer









                                      $endgroup$

















                                        0












                                        $begingroup$


                                        PHP, 144 bytes





                                        function($a)usort($a,function($b,$c)return strlen($b)-strlen($c););$e=[];foreach($a as$d)[array_unshift,array_push][++$i%2]($e,$d);return$e;


                                        Try it online!



                                        Sadly, PHP just doesn't have a lot of syntactic sugar to make this shorter. Submitting it anyway!






                                        share|improve this answer









                                        $endgroup$















                                          0












                                          0








                                          0





                                          $begingroup$


                                          PHP, 144 bytes





                                          function($a)usort($a,function($b,$c)return strlen($b)-strlen($c););$e=[];foreach($a as$d)[array_unshift,array_push][++$i%2]($e,$d);return$e;


                                          Try it online!



                                          Sadly, PHP just doesn't have a lot of syntactic sugar to make this shorter. Submitting it anyway!






                                          share|improve this answer









                                          $endgroup$




                                          PHP, 144 bytes





                                          function($a)usort($a,function($b,$c)return strlen($b)-strlen($c););$e=[];foreach($a as$d)[array_unshift,array_push][++$i%2]($e,$d);return$e;


                                          Try it online!



                                          Sadly, PHP just doesn't have a lot of syntactic sugar to make this shorter. Submitting it anyway!







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered 50 mins ago









                                          gwaughgwaugh

                                          2,048516




                                          2,048516





















                                              0












                                              $begingroup$

                                              Javascript 79 bytes



                                              Takes input as an array of strings, outputs an arrow-sorted array of strings.



                                              f=s=>s.sort((a,b)=>a.length-b.length).reduce((m,x,i)=>i%2?[...m,x]:[x,...m],[])


                                              Explanation



                                              f = s => // take input as an array of strings s
                                              s.sort((a,b)=>a.length-b.length) // sort input by string length
                                              .reduce( // reduce
                                              (m,x,i)=>i%2?[...m,x]:[x,...m], // if index is even, stick string x at the end of the memo
                                              // array, else at the beginning
                                              [] // memo initialized to empty array
                                              )





                                              share|improve this answer









                                              $endgroup$

















                                                0












                                                $begingroup$

                                                Javascript 79 bytes



                                                Takes input as an array of strings, outputs an arrow-sorted array of strings.



                                                f=s=>s.sort((a,b)=>a.length-b.length).reduce((m,x,i)=>i%2?[...m,x]:[x,...m],[])


                                                Explanation



                                                f = s => // take input as an array of strings s
                                                s.sort((a,b)=>a.length-b.length) // sort input by string length
                                                .reduce( // reduce
                                                (m,x,i)=>i%2?[...m,x]:[x,...m], // if index is even, stick string x at the end of the memo
                                                // array, else at the beginning
                                                [] // memo initialized to empty array
                                                )





                                                share|improve this answer









                                                $endgroup$















                                                  0












                                                  0








                                                  0





                                                  $begingroup$

                                                  Javascript 79 bytes



                                                  Takes input as an array of strings, outputs an arrow-sorted array of strings.



                                                  f=s=>s.sort((a,b)=>a.length-b.length).reduce((m,x,i)=>i%2?[...m,x]:[x,...m],[])


                                                  Explanation



                                                  f = s => // take input as an array of strings s
                                                  s.sort((a,b)=>a.length-b.length) // sort input by string length
                                                  .reduce( // reduce
                                                  (m,x,i)=>i%2?[...m,x]:[x,...m], // if index is even, stick string x at the end of the memo
                                                  // array, else at the beginning
                                                  [] // memo initialized to empty array
                                                  )





                                                  share|improve this answer









                                                  $endgroup$



                                                  Javascript 79 bytes



                                                  Takes input as an array of strings, outputs an arrow-sorted array of strings.



                                                  f=s=>s.sort((a,b)=>a.length-b.length).reduce((m,x,i)=>i%2?[...m,x]:[x,...m],[])


                                                  Explanation



                                                  f = s => // take input as an array of strings s
                                                  s.sort((a,b)=>a.length-b.length) // sort input by string length
                                                  .reduce( // reduce
                                                  (m,x,i)=>i%2?[...m,x]:[x,...m], // if index is even, stick string x at the end of the memo
                                                  // array, else at the beginning
                                                  [] // memo initialized to empty array
                                                  )






                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered 30 mins ago









                                                  asgallantasgallant

                                                  1994




                                                  1994





















                                                      0












                                                      $begingroup$


                                                      PowerShell, 66 bytes





                                                      1..($a=$args|sort l*).count|?$_%2|%$a[-$_];$x=,$a[-++$_]+$x;$x


                                                      Try it online!



                                                      Takes input via splatting, which manifests on TIO as separate command-line arguments. sorts on the length, stores that into $a, and constructs a range from 1 up to the count of input strings. We then pull out only the odd ones ?$_%2 and feed those into a loop |%.... Each iteration, we put the "last", then the "third from last", and so on onto the pipeline with $a[-$_]. Separately, we also accumulate into $x the "second from last", "fourth from last", etc. Out of the loop and the pipeline is flushed (so those elements are output) and then we output $x. In both instances, the default output gives us newlines between items automatically.





                                                      share









                                                      $endgroup$

















                                                        0












                                                        $begingroup$


                                                        PowerShell, 66 bytes





                                                        1..($a=$args|sort l*).count|?$_%2|%$a[-$_];$x=,$a[-++$_]+$x;$x


                                                        Try it online!



                                                        Takes input via splatting, which manifests on TIO as separate command-line arguments. sorts on the length, stores that into $a, and constructs a range from 1 up to the count of input strings. We then pull out only the odd ones ?$_%2 and feed those into a loop |%.... Each iteration, we put the "last", then the "third from last", and so on onto the pipeline with $a[-$_]. Separately, we also accumulate into $x the "second from last", "fourth from last", etc. Out of the loop and the pipeline is flushed (so those elements are output) and then we output $x. In both instances, the default output gives us newlines between items automatically.





                                                        share









                                                        $endgroup$















                                                          0












                                                          0








                                                          0





                                                          $begingroup$


                                                          PowerShell, 66 bytes





                                                          1..($a=$args|sort l*).count|?$_%2|%$a[-$_];$x=,$a[-++$_]+$x;$x


                                                          Try it online!



                                                          Takes input via splatting, which manifests on TIO as separate command-line arguments. sorts on the length, stores that into $a, and constructs a range from 1 up to the count of input strings. We then pull out only the odd ones ?$_%2 and feed those into a loop |%.... Each iteration, we put the "last", then the "third from last", and so on onto the pipeline with $a[-$_]. Separately, we also accumulate into $x the "second from last", "fourth from last", etc. Out of the loop and the pipeline is flushed (so those elements are output) and then we output $x. In both instances, the default output gives us newlines between items automatically.





                                                          share









                                                          $endgroup$




                                                          PowerShell, 66 bytes





                                                          1..($a=$args|sort l*).count|?$_%2|%$a[-$_];$x=,$a[-++$_]+$x;$x


                                                          Try it online!



                                                          Takes input via splatting, which manifests on TIO as separate command-line arguments. sorts on the length, stores that into $a, and constructs a range from 1 up to the count of input strings. We then pull out only the odd ones ?$_%2 and feed those into a loop |%.... Each iteration, we put the "last", then the "third from last", and so on onto the pipeline with $a[-$_]. Separately, we also accumulate into $x the "second from last", "fourth from last", etc. Out of the loop and the pipeline is flushed (so those elements are output) and then we output $x. In both instances, the default output gives us newlines between items automatically.






                                                          share











                                                          share


                                                          share










                                                          answered 1 min ago









                                                          AdmBorkBorkAdmBorkBork

                                                          27.6k466237




                                                          27.6k466237





















                                                              -1












                                                              $begingroup$

                                                              Javascript 95 Bytes



                                                              s=>s.sort((x,y)=>x.length-y.length).reduce((a,e,i)=>i%2?a.push(e):a.unshift(e);return a;,[]);





                                                              share|improve this answer










                                                              New contributor




                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.






                                                              $endgroup$












                                                              • $begingroup$
                                                                -1 s.sort() sorts the strings lexicographically, not by string length.
                                                                $endgroup$
                                                                – asgallant
                                                                39 mins ago










                                                              • $begingroup$
                                                                Right, (x,y)=>x.length-y.length, should fix that.
                                                                $endgroup$
                                                                – somsom
                                                                31 mins ago















                                                              -1












                                                              $begingroup$

                                                              Javascript 95 Bytes



                                                              s=>s.sort((x,y)=>x.length-y.length).reduce((a,e,i)=>i%2?a.push(e):a.unshift(e);return a;,[]);





                                                              share|improve this answer










                                                              New contributor




                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.






                                                              $endgroup$












                                                              • $begingroup$
                                                                -1 s.sort() sorts the strings lexicographically, not by string length.
                                                                $endgroup$
                                                                – asgallant
                                                                39 mins ago










                                                              • $begingroup$
                                                                Right, (x,y)=>x.length-y.length, should fix that.
                                                                $endgroup$
                                                                – somsom
                                                                31 mins ago













                                                              -1












                                                              -1








                                                              -1





                                                              $begingroup$

                                                              Javascript 95 Bytes



                                                              s=>s.sort((x,y)=>x.length-y.length).reduce((a,e,i)=>i%2?a.push(e):a.unshift(e);return a;,[]);





                                                              share|improve this answer










                                                              New contributor




                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.






                                                              $endgroup$



                                                              Javascript 95 Bytes



                                                              s=>s.sort((x,y)=>x.length-y.length).reduce((a,e,i)=>i%2?a.push(e):a.unshift(e);return a;,[]);






                                                              share|improve this answer










                                                              New contributor




                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.









                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited 6 mins ago









                                                              Embodiment of Ignorance

                                                              2,338126




                                                              2,338126






                                                              New contributor




                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.









                                                              answered 50 mins ago









                                                              somsomsomsom

                                                              11




                                                              11




                                                              New contributor




                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.





                                                              New contributor





                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.






                                                              somsom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.











                                                              • $begingroup$
                                                                -1 s.sort() sorts the strings lexicographically, not by string length.
                                                                $endgroup$
                                                                – asgallant
                                                                39 mins ago










                                                              • $begingroup$
                                                                Right, (x,y)=>x.length-y.length, should fix that.
                                                                $endgroup$
                                                                – somsom
                                                                31 mins ago
















                                                              • $begingroup$
                                                                -1 s.sort() sorts the strings lexicographically, not by string length.
                                                                $endgroup$
                                                                – asgallant
                                                                39 mins ago










                                                              • $begingroup$
                                                                Right, (x,y)=>x.length-y.length, should fix that.
                                                                $endgroup$
                                                                – somsom
                                                                31 mins ago















                                                              $begingroup$
                                                              -1 s.sort() sorts the strings lexicographically, not by string length.
                                                              $endgroup$
                                                              – asgallant
                                                              39 mins ago




                                                              $begingroup$
                                                              -1 s.sort() sorts the strings lexicographically, not by string length.
                                                              $endgroup$
                                                              – asgallant
                                                              39 mins ago












                                                              $begingroup$
                                                              Right, (x,y)=>x.length-y.length, should fix that.
                                                              $endgroup$
                                                              – somsom
                                                              31 mins ago




                                                              $begingroup$
                                                              Right, (x,y)=>x.length-y.length, should fix that.
                                                              $endgroup$
                                                              – somsom
                                                              31 mins ago










                                                              Teleporting Goat is a new contributor. Be nice, and check out our Code of Conduct.









                                                              draft saved

                                                              draft discarded


















                                                              Teleporting Goat is a new contributor. Be nice, and check out our Code of Conduct.












                                                              Teleporting Goat is a new contributor. Be nice, and check out our Code of Conduct.











                                                              Teleporting Goat is a new contributor. Be nice, and check out our Code of Conduct.














                                                              If this is an answer to a challenge…



                                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                                              More generally…



                                                              • …Please make sure to answer the question and provide sufficient detail.


                                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function ()
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182615%2farrow-those-variables%23new-answer', 'question_page');

                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              Category:Fedor von Bock Media in category "Fedor von Bock"Navigation menuUpload mediaISNI: 0000 0000 5511 3417VIAF ID: 24712551GND ID: 119294796Library of Congress authority ID: n96068363BnF ID: 12534305fSUDOC authorities ID: 034604189Open Library ID: OL338253ANKCR AUT ID: jn19990000869National Library of Israel ID: 000514068National Thesaurus for Author Names ID: 341574317ReasonatorScholiaStatistics

                                                              Reverse int within the 32-bit signed integer range: [−2^31, 2^31 − 1]Combining two 32-bit integers into one 64-bit integerDetermine if an int is within rangeLossy packing 32 bit integer to 16 bitComputing the square root of a 64-bit integerKeeping integer addition within boundsSafe multiplication of two 64-bit signed integersLeetcode 10: Regular Expression MatchingSigned integer-to-ascii x86_64 assembler macroReverse the digits of an Integer“Add two numbers given in reverse order from a linked list”

                                                              Log på Navigationsmenu