Largest and Smallest Possible Number











up vote
16
down vote

favorite
1












Task



Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them.



Rules



Input,Output can be in any convenient format.



The array may have at most 1 decimal number.



Examples



input:[22,33,44,55.55,33]
output:4433332255.55,55.5522333344

input:[34,900,3,11,9]
output:990034311,113349009

input:[99.93,9,3,39]
output:939399.93,99.933399

input:[45.45,45,45,45]
output:45454545.45,45.45454545

input:[12,21,34,43,45.1]
output:4334211245.1,45.112213443


This is code-golf so shortest code wins.










share|improve this question


















  • 1




    Wouldn't the first output be: 4422333355.55, 55.5544333322? Those are smaller and larger respectively.
    – ouflak
    Nov 15 at 12:26










  • @ouflak, you have to output the largest and smallest.
    – Vedant Kandoi
    Nov 15 at 12:30






  • 1




    Nevermind, see it now. Got confused with the decimal place.
    – ouflak
    Nov 15 at 12:35












  • Would [[55.55,22,33,33,44],[44,33,33,22,55.55]] be an acceptable output format?
    – Shaggy
    Nov 15 at 12:44






  • 1




    Any way is fine @Jordan
    – Vedant Kandoi
    Nov 16 at 5:34















up vote
16
down vote

favorite
1












Task



Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them.



Rules



Input,Output can be in any convenient format.



The array may have at most 1 decimal number.



Examples



input:[22,33,44,55.55,33]
output:4433332255.55,55.5522333344

input:[34,900,3,11,9]
output:990034311,113349009

input:[99.93,9,3,39]
output:939399.93,99.933399

input:[45.45,45,45,45]
output:45454545.45,45.45454545

input:[12,21,34,43,45.1]
output:4334211245.1,45.112213443


This is code-golf so shortest code wins.










share|improve this question


















  • 1




    Wouldn't the first output be: 4422333355.55, 55.5544333322? Those are smaller and larger respectively.
    – ouflak
    Nov 15 at 12:26










  • @ouflak, you have to output the largest and smallest.
    – Vedant Kandoi
    Nov 15 at 12:30






  • 1




    Nevermind, see it now. Got confused with the decimal place.
    – ouflak
    Nov 15 at 12:35












  • Would [[55.55,22,33,33,44],[44,33,33,22,55.55]] be an acceptable output format?
    – Shaggy
    Nov 15 at 12:44






  • 1




    Any way is fine @Jordan
    – Vedant Kandoi
    Nov 16 at 5:34













up vote
16
down vote

favorite
1









up vote
16
down vote

favorite
1






1





Task



Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them.



Rules



Input,Output can be in any convenient format.



The array may have at most 1 decimal number.



Examples



input:[22,33,44,55.55,33]
output:4433332255.55,55.5522333344

input:[34,900,3,11,9]
output:990034311,113349009

input:[99.93,9,3,39]
output:939399.93,99.933399

input:[45.45,45,45,45]
output:45454545.45,45.45454545

input:[12,21,34,43,45.1]
output:4334211245.1,45.112213443


This is code-golf so shortest code wins.










share|improve this question













Task



Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them.



Rules



Input,Output can be in any convenient format.



The array may have at most 1 decimal number.



Examples



input:[22,33,44,55.55,33]
output:4433332255.55,55.5522333344

input:[34,900,3,11,9]
output:990034311,113349009

input:[99.93,9,3,39]
output:939399.93,99.933399

input:[45.45,45,45,45]
output:45454545.45,45.45454545

input:[12,21,34,43,45.1]
output:4334211245.1,45.112213443


This is code-golf so shortest code wins.







code-golf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 at 12:18









Vedant Kandoi

54714




54714








  • 1




    Wouldn't the first output be: 4422333355.55, 55.5544333322? Those are smaller and larger respectively.
    – ouflak
    Nov 15 at 12:26










  • @ouflak, you have to output the largest and smallest.
    – Vedant Kandoi
    Nov 15 at 12:30






  • 1




    Nevermind, see it now. Got confused with the decimal place.
    – ouflak
    Nov 15 at 12:35












  • Would [[55.55,22,33,33,44],[44,33,33,22,55.55]] be an acceptable output format?
    – Shaggy
    Nov 15 at 12:44






  • 1




    Any way is fine @Jordan
    – Vedant Kandoi
    Nov 16 at 5:34














  • 1




    Wouldn't the first output be: 4422333355.55, 55.5544333322? Those are smaller and larger respectively.
    – ouflak
    Nov 15 at 12:26










  • @ouflak, you have to output the largest and smallest.
    – Vedant Kandoi
    Nov 15 at 12:30






  • 1




    Nevermind, see it now. Got confused with the decimal place.
    – ouflak
    Nov 15 at 12:35












  • Would [[55.55,22,33,33,44],[44,33,33,22,55.55]] be an acceptable output format?
    – Shaggy
    Nov 15 at 12:44






  • 1




    Any way is fine @Jordan
    – Vedant Kandoi
    Nov 16 at 5:34








1




1




Wouldn't the first output be: 4422333355.55, 55.5544333322? Those are smaller and larger respectively.
– ouflak
Nov 15 at 12:26




Wouldn't the first output be: 4422333355.55, 55.5544333322? Those are smaller and larger respectively.
– ouflak
Nov 15 at 12:26












@ouflak, you have to output the largest and smallest.
– Vedant Kandoi
Nov 15 at 12:30




@ouflak, you have to output the largest and smallest.
– Vedant Kandoi
Nov 15 at 12:30




1




1




Nevermind, see it now. Got confused with the decimal place.
– ouflak
Nov 15 at 12:35






Nevermind, see it now. Got confused with the decimal place.
– ouflak
Nov 15 at 12:35














Would [[55.55,22,33,33,44],[44,33,33,22,55.55]] be an acceptable output format?
– Shaggy
Nov 15 at 12:44




Would [[55.55,22,33,33,44],[44,33,33,22,55.55]] be an acceptable output format?
– Shaggy
Nov 15 at 12:44




1




1




Any way is fine @Jordan
– Vedant Kandoi
Nov 16 at 5:34




Any way is fine @Jordan
– Vedant Kandoi
Nov 16 at 5:34










10 Answers
10






active

oldest

votes

















up vote
4
down vote














Python 2, 84 80 78 76 bytes





lambda a:[''.join(sorted(a,key=lambda s:'.'in s or s+s)[::i])for i in[-1,1]]


Try it online!



-2 bytes, thanks to Arnauld






share|improve this answer






























    up vote
    3
    down vote














    05AB1E, 11 bytes



    œJΣ'.¡ï}Á2£


    Try it online!
    or as a Test Suite



    Explanation



     œ             # get permutations of input
    J # join each
    Σ } # sort by
    '.¡ # splitting into [before decimal, after decimal]
    ï # and converting each to int
    Á # rotate the result right
    2£ # and take the first 2 values





    share|improve this answer





















    • Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD
      – Kevin Cruijssen
      Nov 15 at 13:25










    • @KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.
      – Emigna
      Nov 15 at 13:33


















    up vote
    3
    down vote













    JavaScript (ES6), 68 66 bytes



    a=>[1,-1].map(n=>a.sort((a,b)=>[a%1||a]+b<[b%1||b]+a?n:-n).join``)


    Try it online!



    How?



    We use the following test to compare two values in the input array:



    [a % 1 || a] + b < [b % 1 || b] + a


    The expression x % 1 || x returns the decimal part of $x$ if $x$ is a decimal number, or leaves $x$ unchanged otherwise.



    The expression [x % 1 || x] + y coerces the above result to a string and concatenates it with the other value.



    If there's a decimal number in the list, it must always be considered as the smallest value. By applying our conversion, a decimal number is turned into a string starting with "0.", which is lexicographically ordered before anything else.



    Examples:



      a |   b | [a%1||a]+b | [b%1||b]+a
    ----+-----+------------+------------
    4 | 5 | "45" | "54"
    10 | 11 | "1011" | "1110"
    8 | 80 | "880" | "808"
    7 | 9.5 | "79.5" | "0.57"





    share|improve this answer






























      up vote
      3
      down vote













      Japt, 14 11 bytes



      á m¬ñn é v2


      Try it



      1 byte saved thanks to Luis, please +1 his solution too.



      á               :Permutations
      m :Map
      ¬ : Join
      ñ :Sort by
      n : Converting each to a number
      é :Rotate right
      v2 :Remove & return the first 2 elements





      share|improve this answer























      • Ok, this is better!! damn!! that é was hidden all this time!!
        – Luis felipe De jesus Munoz
        Nov 15 at 13:07


















      up vote
      3
      down vote














      Japt, 14 11 10 bytes



      á m¬ñn gJò


      Try it online!






      share|improve this answer























      • Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.
        – Shaggy
        Nov 15 at 12:34










      • 12 bytes, using the -h flag.
        – Shaggy
        Nov 15 at 12:56












      • 11 bytes, using the -g flag. Also works with í instead of ï.
        – Shaggy
        Nov 15 at 13:00










      • @Shaggy Excellent! Thanks!!
        – Luis felipe De jesus Munoz
        Nov 15 at 13:06










      • Dang! Looks like I gave up to soon; very nicely done.
        – Shaggy
        Nov 15 at 17:18


















      up vote
      3
      down vote














      Jelly, 6 bytes



      Œ!VṢ.ị


      Try it online!



      Explanation:



      Œ!VṢ.ị Arguments: x
      Œ! Permutations of x
      V Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
      Ṣ Sort
      .ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)





      share|improve this answer























      • I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.
        – Kevin Cruijssen
        Nov 15 at 13:10








      • 1




        @KevinCruijssen It actually gets the last and first item. :P
        – Erik the Outgolfer
        Nov 15 at 13:12










      • I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?
        – Cowabunghole
        Nov 15 at 16:23










      • Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.
        – Cowabunghole
        Nov 15 at 16:59






      • 1




        @Cowabunghole Yes, Jelly is 1-indexed.
        – Erik the Outgolfer
        Nov 15 at 17:13


















      up vote
      3
      down vote














      Ruby, 56 45 bytes





      ->a{a.permutation.map{|p|p.join.to_f}.minmax}


      Try it online!



      -11 bytes, thanks Jordan






      share|improve this answer










      New contributor




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














      • 1




        Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: tio.run/…
        – Jordan
        Nov 16 at 16:04


















      up vote
      2
      down vote













      Pyth, 13 12 bytes



      hM_BSvsM.p`M


      Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.



      hM_BSvsM.p`MQ   Implicit: Q=eval(input())
      Trailing Q inferred
      `MQ Stringify all elements of Q
      .p Generate all permutations of the above
      sM Concatenate each permutation
      v Evaluate each as a number
      S Sort them
      _B Pair the sorted list with its reverse
      hM Take the first element of each, implicit print


      Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p






      share|improve this answer






























        up vote
        2
        down vote














        Perl 6, 41 bytes





        {.max,.min}o+<<*.permutations.map(*.join)


        Try it online!



        Alternatives:



        {.max,.min}o+<<*.permutations.map:{.join}
        {.max,.min}o{[map +*.join,.permutations]}
        {.max,.min}o{+<<map *.join,.permutations}





        share|improve this answer






























          up vote
          1
          down vote














          Husk, 10 bytes



          §,▼▲morṁsP


          Try it online or verify all!



          Explanation



          §,▼▲m(rṁs)P  -- example input: [2,3,1.1]
          P -- permutations: [[2,3,1.1],[3,2,1.1],[1.1,3,2],[3,1.1,2],[1.1,2,3],[2,1.1,3]]
          m( ) -- map the following
          (example with [1.1,2,3])
          ṁs -- | show each and join: "1.123"
          r -- | read: 1.123
          -- : [231.1,321.1,1.132,31.12,1.123,21.13]
          §, -- fork and join as tuple
          ▼ -- | min: 1.123
          ▲ -- | max: 321.1
          -- : (1.123,321.1)





          share|improve this answer





















            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',
            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
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175999%2flargest-and-smallest-possible-number%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








            up vote
            4
            down vote














            Python 2, 84 80 78 76 bytes





            lambda a:[''.join(sorted(a,key=lambda s:'.'in s or s+s)[::i])for i in[-1,1]]


            Try it online!



            -2 bytes, thanks to Arnauld






            share|improve this answer



























              up vote
              4
              down vote














              Python 2, 84 80 78 76 bytes





              lambda a:[''.join(sorted(a,key=lambda s:'.'in s or s+s)[::i])for i in[-1,1]]


              Try it online!



              -2 bytes, thanks to Arnauld






              share|improve this answer

























                up vote
                4
                down vote










                up vote
                4
                down vote










                Python 2, 84 80 78 76 bytes





                lambda a:[''.join(sorted(a,key=lambda s:'.'in s or s+s)[::i])for i in[-1,1]]


                Try it online!



                -2 bytes, thanks to Arnauld






                share|improve this answer















                Python 2, 84 80 78 76 bytes





                lambda a:[''.join(sorted(a,key=lambda s:'.'in s or s+s)[::i])for i in[-1,1]]


                Try it online!



                -2 bytes, thanks to Arnauld







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 15 at 14:36

























                answered Nov 15 at 12:36









                TFeld

                13.5k21139




                13.5k21139






















                    up vote
                    3
                    down vote














                    05AB1E, 11 bytes



                    œJΣ'.¡ï}Á2£


                    Try it online!
                    or as a Test Suite



                    Explanation



                     œ             # get permutations of input
                    J # join each
                    Σ } # sort by
                    '.¡ # splitting into [before decimal, after decimal]
                    ï # and converting each to int
                    Á # rotate the result right
                    2£ # and take the first 2 values





                    share|improve this answer





















                    • Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD
                      – Kevin Cruijssen
                      Nov 15 at 13:25










                    • @KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.
                      – Emigna
                      Nov 15 at 13:33















                    up vote
                    3
                    down vote














                    05AB1E, 11 bytes



                    œJΣ'.¡ï}Á2£


                    Try it online!
                    or as a Test Suite



                    Explanation



                     œ             # get permutations of input
                    J # join each
                    Σ } # sort by
                    '.¡ # splitting into [before decimal, after decimal]
                    ï # and converting each to int
                    Á # rotate the result right
                    2£ # and take the first 2 values





                    share|improve this answer





















                    • Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD
                      – Kevin Cruijssen
                      Nov 15 at 13:25










                    • @KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.
                      – Emigna
                      Nov 15 at 13:33













                    up vote
                    3
                    down vote










                    up vote
                    3
                    down vote










                    05AB1E, 11 bytes



                    œJΣ'.¡ï}Á2£


                    Try it online!
                    or as a Test Suite



                    Explanation



                     œ             # get permutations of input
                    J # join each
                    Σ } # sort by
                    '.¡ # splitting into [before decimal, after decimal]
                    ï # and converting each to int
                    Á # rotate the result right
                    2£ # and take the first 2 values





                    share|improve this answer













                    05AB1E, 11 bytes



                    œJΣ'.¡ï}Á2£


                    Try it online!
                    or as a Test Suite



                    Explanation



                     œ             # get permutations of input
                    J # join each
                    Σ } # sort by
                    '.¡ # splitting into [before decimal, after decimal]
                    ï # and converting each to int
                    Á # rotate the result right
                    2£ # and take the first 2 values






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 15 at 12:55









                    Emigna

                    44.8k432136




                    44.8k432136












                    • Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD
                      – Kevin Cruijssen
                      Nov 15 at 13:25










                    • @KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.
                      – Emigna
                      Nov 15 at 13:33


















                    • Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD
                      – Kevin Cruijssen
                      Nov 15 at 13:25










                    • @KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.
                      – Emigna
                      Nov 15 at 13:33
















                    Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD
                    – Kevin Cruijssen
                    Nov 15 at 13:25




                    Too bad we don't have a cast to float. I remember there was one in the Legacy, but I just looked it up and apparently it was a stringified cast to float, which is pretty useless since you want floats instead of strings to sort on.. xD
                    – Kevin Cruijssen
                    Nov 15 at 13:25












                    @KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.
                    – Emigna
                    Nov 15 at 13:33




                    @KevinCruijssen: Yeah. We had an is_number but unfortunately no to_number.
                    – Emigna
                    Nov 15 at 13:33










                    up vote
                    3
                    down vote













                    JavaScript (ES6), 68 66 bytes



                    a=>[1,-1].map(n=>a.sort((a,b)=>[a%1||a]+b<[b%1||b]+a?n:-n).join``)


                    Try it online!



                    How?



                    We use the following test to compare two values in the input array:



                    [a % 1 || a] + b < [b % 1 || b] + a


                    The expression x % 1 || x returns the decimal part of $x$ if $x$ is a decimal number, or leaves $x$ unchanged otherwise.



                    The expression [x % 1 || x] + y coerces the above result to a string and concatenates it with the other value.



                    If there's a decimal number in the list, it must always be considered as the smallest value. By applying our conversion, a decimal number is turned into a string starting with "0.", which is lexicographically ordered before anything else.



                    Examples:



                      a |   b | [a%1||a]+b | [b%1||b]+a
                    ----+-----+------------+------------
                    4 | 5 | "45" | "54"
                    10 | 11 | "1011" | "1110"
                    8 | 80 | "880" | "808"
                    7 | 9.5 | "79.5" | "0.57"





                    share|improve this answer



























                      up vote
                      3
                      down vote













                      JavaScript (ES6), 68 66 bytes



                      a=>[1,-1].map(n=>a.sort((a,b)=>[a%1||a]+b<[b%1||b]+a?n:-n).join``)


                      Try it online!



                      How?



                      We use the following test to compare two values in the input array:



                      [a % 1 || a] + b < [b % 1 || b] + a


                      The expression x % 1 || x returns the decimal part of $x$ if $x$ is a decimal number, or leaves $x$ unchanged otherwise.



                      The expression [x % 1 || x] + y coerces the above result to a string and concatenates it with the other value.



                      If there's a decimal number in the list, it must always be considered as the smallest value. By applying our conversion, a decimal number is turned into a string starting with "0.", which is lexicographically ordered before anything else.



                      Examples:



                        a |   b | [a%1||a]+b | [b%1||b]+a
                      ----+-----+------------+------------
                      4 | 5 | "45" | "54"
                      10 | 11 | "1011" | "1110"
                      8 | 80 | "880" | "808"
                      7 | 9.5 | "79.5" | "0.57"





                      share|improve this answer

























                        up vote
                        3
                        down vote










                        up vote
                        3
                        down vote









                        JavaScript (ES6), 68 66 bytes



                        a=>[1,-1].map(n=>a.sort((a,b)=>[a%1||a]+b<[b%1||b]+a?n:-n).join``)


                        Try it online!



                        How?



                        We use the following test to compare two values in the input array:



                        [a % 1 || a] + b < [b % 1 || b] + a


                        The expression x % 1 || x returns the decimal part of $x$ if $x$ is a decimal number, or leaves $x$ unchanged otherwise.



                        The expression [x % 1 || x] + y coerces the above result to a string and concatenates it with the other value.



                        If there's a decimal number in the list, it must always be considered as the smallest value. By applying our conversion, a decimal number is turned into a string starting with "0.", which is lexicographically ordered before anything else.



                        Examples:



                          a |   b | [a%1||a]+b | [b%1||b]+a
                        ----+-----+------------+------------
                        4 | 5 | "45" | "54"
                        10 | 11 | "1011" | "1110"
                        8 | 80 | "880" | "808"
                        7 | 9.5 | "79.5" | "0.57"





                        share|improve this answer














                        JavaScript (ES6), 68 66 bytes



                        a=>[1,-1].map(n=>a.sort((a,b)=>[a%1||a]+b<[b%1||b]+a?n:-n).join``)


                        Try it online!



                        How?



                        We use the following test to compare two values in the input array:



                        [a % 1 || a] + b < [b % 1 || b] + a


                        The expression x % 1 || x returns the decimal part of $x$ if $x$ is a decimal number, or leaves $x$ unchanged otherwise.



                        The expression [x % 1 || x] + y coerces the above result to a string and concatenates it with the other value.



                        If there's a decimal number in the list, it must always be considered as the smallest value. By applying our conversion, a decimal number is turned into a string starting with "0.", which is lexicographically ordered before anything else.



                        Examples:



                          a |   b | [a%1||a]+b | [b%1||b]+a
                        ----+-----+------------+------------
                        4 | 5 | "45" | "54"
                        10 | 11 | "1011" | "1110"
                        8 | 80 | "880" | "808"
                        7 | 9.5 | "79.5" | "0.57"






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Nov 15 at 14:46

























                        answered Nov 15 at 13:07









                        Arnauld

                        69.2k585293




                        69.2k585293






















                            up vote
                            3
                            down vote













                            Japt, 14 11 bytes



                            á m¬ñn é v2


                            Try it



                            1 byte saved thanks to Luis, please +1 his solution too.



                            á               :Permutations
                            m :Map
                            ¬ : Join
                            ñ :Sort by
                            n : Converting each to a number
                            é :Rotate right
                            v2 :Remove & return the first 2 elements





                            share|improve this answer























                            • Ok, this is better!! damn!! that é was hidden all this time!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:07















                            up vote
                            3
                            down vote













                            Japt, 14 11 bytes



                            á m¬ñn é v2


                            Try it



                            1 byte saved thanks to Luis, please +1 his solution too.



                            á               :Permutations
                            m :Map
                            ¬ : Join
                            ñ :Sort by
                            n : Converting each to a number
                            é :Rotate right
                            v2 :Remove & return the first 2 elements





                            share|improve this answer























                            • Ok, this is better!! damn!! that é was hidden all this time!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:07













                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote









                            Japt, 14 11 bytes



                            á m¬ñn é v2


                            Try it



                            1 byte saved thanks to Luis, please +1 his solution too.



                            á               :Permutations
                            m :Map
                            ¬ : Join
                            ñ :Sort by
                            n : Converting each to a number
                            é :Rotate right
                            v2 :Remove & return the first 2 elements





                            share|improve this answer














                            Japt, 14 11 bytes



                            á m¬ñn é v2


                            Try it



                            1 byte saved thanks to Luis, please +1 his solution too.



                            á               :Permutations
                            m :Map
                            ¬ : Join
                            ñ :Sort by
                            n : Converting each to a number
                            é :Rotate right
                            v2 :Remove & return the first 2 elements






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 15 at 15:30

























                            answered Nov 15 at 12:40









                            Shaggy

                            18.1k21663




                            18.1k21663












                            • Ok, this is better!! damn!! that é was hidden all this time!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:07


















                            • Ok, this is better!! damn!! that é was hidden all this time!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:07
















                            Ok, this is better!! damn!! that é was hidden all this time!!
                            – Luis felipe De jesus Munoz
                            Nov 15 at 13:07




                            Ok, this is better!! damn!! that é was hidden all this time!!
                            – Luis felipe De jesus Munoz
                            Nov 15 at 13:07










                            up vote
                            3
                            down vote














                            Japt, 14 11 10 bytes



                            á m¬ñn gJò


                            Try it online!






                            share|improve this answer























                            • Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.
                              – Shaggy
                              Nov 15 at 12:34










                            • 12 bytes, using the -h flag.
                              – Shaggy
                              Nov 15 at 12:56












                            • 11 bytes, using the -g flag. Also works with í instead of ï.
                              – Shaggy
                              Nov 15 at 13:00










                            • @Shaggy Excellent! Thanks!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:06










                            • Dang! Looks like I gave up to soon; very nicely done.
                              – Shaggy
                              Nov 15 at 17:18















                            up vote
                            3
                            down vote














                            Japt, 14 11 10 bytes



                            á m¬ñn gJò


                            Try it online!






                            share|improve this answer























                            • Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.
                              – Shaggy
                              Nov 15 at 12:34










                            • 12 bytes, using the -h flag.
                              – Shaggy
                              Nov 15 at 12:56












                            • 11 bytes, using the -g flag. Also works with í instead of ï.
                              – Shaggy
                              Nov 15 at 13:00










                            • @Shaggy Excellent! Thanks!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:06










                            • Dang! Looks like I gave up to soon; very nicely done.
                              – Shaggy
                              Nov 15 at 17:18













                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote










                            Japt, 14 11 10 bytes



                            á m¬ñn gJò


                            Try it online!






                            share|improve this answer















                            Japt, 14 11 10 bytes



                            á m¬ñn gJò


                            Try it online!







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 15 at 17:16

























                            answered Nov 15 at 12:32









                            Luis felipe De jesus Munoz

                            3,99421253




                            3,99421253












                            • Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.
                              – Shaggy
                              Nov 15 at 12:34










                            • 12 bytes, using the -h flag.
                              – Shaggy
                              Nov 15 at 12:56












                            • 11 bytes, using the -g flag. Also works with í instead of ï.
                              – Shaggy
                              Nov 15 at 13:00










                            • @Shaggy Excellent! Thanks!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:06










                            • Dang! Looks like I gave up to soon; very nicely done.
                              – Shaggy
                              Nov 15 at 17:18


















                            • Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.
                              – Shaggy
                              Nov 15 at 12:34










                            • 12 bytes, using the -h flag.
                              – Shaggy
                              Nov 15 at 12:56












                            • 11 bytes, using the -g flag. Also works with í instead of ï.
                              – Shaggy
                              Nov 15 at 13:00










                            • @Shaggy Excellent! Thanks!!
                              – Luis felipe De jesus Munoz
                              Nov 15 at 13:06










                            • Dang! Looks like I gave up to soon; very nicely done.
                              – Shaggy
                              Nov 15 at 17:18
















                            Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.
                            – Shaggy
                            Nov 15 at 12:34




                            Nice one. I had á ®¬nÃn for the first line - kicking myself that I didn't think of your way.
                            – Shaggy
                            Nov 15 at 12:34












                            12 bytes, using the -h flag.
                            – Shaggy
                            Nov 15 at 12:56






                            12 bytes, using the -h flag.
                            – Shaggy
                            Nov 15 at 12:56














                            11 bytes, using the -g flag. Also works with í instead of ï.
                            – Shaggy
                            Nov 15 at 13:00




                            11 bytes, using the -g flag. Also works with í instead of ï.
                            – Shaggy
                            Nov 15 at 13:00












                            @Shaggy Excellent! Thanks!!
                            – Luis felipe De jesus Munoz
                            Nov 15 at 13:06




                            @Shaggy Excellent! Thanks!!
                            – Luis felipe De jesus Munoz
                            Nov 15 at 13:06












                            Dang! Looks like I gave up to soon; very nicely done.
                            – Shaggy
                            Nov 15 at 17:18




                            Dang! Looks like I gave up to soon; very nicely done.
                            – Shaggy
                            Nov 15 at 17:18










                            up vote
                            3
                            down vote














                            Jelly, 6 bytes



                            Œ!VṢ.ị


                            Try it online!



                            Explanation:



                            Œ!VṢ.ị Arguments: x
                            Œ! Permutations of x
                            V Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
                            Ṣ Sort
                            .ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)





                            share|improve this answer























                            • I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.
                              – Kevin Cruijssen
                              Nov 15 at 13:10








                            • 1




                              @KevinCruijssen It actually gets the last and first item. :P
                              – Erik the Outgolfer
                              Nov 15 at 13:12










                            • I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?
                              – Cowabunghole
                              Nov 15 at 16:23










                            • Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.
                              – Cowabunghole
                              Nov 15 at 16:59






                            • 1




                              @Cowabunghole Yes, Jelly is 1-indexed.
                              – Erik the Outgolfer
                              Nov 15 at 17:13















                            up vote
                            3
                            down vote














                            Jelly, 6 bytes



                            Œ!VṢ.ị


                            Try it online!



                            Explanation:



                            Œ!VṢ.ị Arguments: x
                            Œ! Permutations of x
                            V Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
                            Ṣ Sort
                            .ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)





                            share|improve this answer























                            • I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.
                              – Kevin Cruijssen
                              Nov 15 at 13:10








                            • 1




                              @KevinCruijssen It actually gets the last and first item. :P
                              – Erik the Outgolfer
                              Nov 15 at 13:12










                            • I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?
                              – Cowabunghole
                              Nov 15 at 16:23










                            • Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.
                              – Cowabunghole
                              Nov 15 at 16:59






                            • 1




                              @Cowabunghole Yes, Jelly is 1-indexed.
                              – Erik the Outgolfer
                              Nov 15 at 17:13













                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote










                            Jelly, 6 bytes



                            Œ!VṢ.ị


                            Try it online!



                            Explanation:



                            Œ!VṢ.ị Arguments: x
                            Œ! Permutations of x
                            V Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
                            Ṣ Sort
                            .ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)





                            share|improve this answer















                            Jelly, 6 bytes



                            Œ!VṢ.ị


                            Try it online!



                            Explanation:



                            Œ!VṢ.ị Arguments: x
                            Œ! Permutations of x
                            V Concatenate the representations of each permutation's elements and evaluate the result as Jelly code
                            Ṣ Sort
                            .ị Get element at index 0.5, i.e. elements at indices 0 (last) and 1 (first)






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Nov 15 at 17:22

























                            answered Nov 15 at 12:22









                            Erik the Outgolfer

                            30.7k429102




                            30.7k429102












                            • I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.
                              – Kevin Cruijssen
                              Nov 15 at 13:10








                            • 1




                              @KevinCruijssen It actually gets the last and first item. :P
                              – Erik the Outgolfer
                              Nov 15 at 13:12










                            • I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?
                              – Cowabunghole
                              Nov 15 at 16:23










                            • Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.
                              – Cowabunghole
                              Nov 15 at 16:59






                            • 1




                              @Cowabunghole Yes, Jelly is 1-indexed.
                              – Erik the Outgolfer
                              Nov 15 at 17:13


















                            • I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.
                              – Kevin Cruijssen
                              Nov 15 at 13:10








                            • 1




                              @KevinCruijssen It actually gets the last and first item. :P
                              – Erik the Outgolfer
                              Nov 15 at 13:12










                            • I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?
                              – Cowabunghole
                              Nov 15 at 16:23










                            • Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.
                              – Cowabunghole
                              Nov 15 at 16:59






                            • 1




                              @Cowabunghole Yes, Jelly is 1-indexed.
                              – Erik the Outgolfer
                              Nov 15 at 17:13
















                            I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.
                            – Kevin Cruijssen
                            Nov 15 at 13:10






                            I never program in Jelly, but .ị is a pretty cool way of getting both the first and last item of a list. Nice answer! +1 from me.
                            – Kevin Cruijssen
                            Nov 15 at 13:10






                            1




                            1




                            @KevinCruijssen It actually gets the last and first item. :P
                            – Erik the Outgolfer
                            Nov 15 at 13:12




                            @KevinCruijssen It actually gets the last and first item. :P
                            – Erik the Outgolfer
                            Nov 15 at 13:12












                            I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?
                            – Cowabunghole
                            Nov 15 at 16:23




                            I've also never programmed in Jelly, but I'm confused as to how .ị works. If I'm reading the docs correctly, I would think gets the element of y at floor(x) and ceil(x), and . is 0.5. Doesn't that mean it will get elements of y at index 0 and 1?
                            – Cowabunghole
                            Nov 15 at 16:23












                            Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.
                            – Cowabunghole
                            Nov 15 at 16:59




                            Is Jelly 1-based indexed? That would explain this behavior but I don't see anything about that in the docs.
                            – Cowabunghole
                            Nov 15 at 16:59




                            1




                            1




                            @Cowabunghole Yes, Jelly is 1-indexed.
                            – Erik the Outgolfer
                            Nov 15 at 17:13




                            @Cowabunghole Yes, Jelly is 1-indexed.
                            – Erik the Outgolfer
                            Nov 15 at 17:13










                            up vote
                            3
                            down vote














                            Ruby, 56 45 bytes





                            ->a{a.permutation.map{|p|p.join.to_f}.minmax}


                            Try it online!



                            -11 bytes, thanks Jordan






                            share|improve this answer










                            New contributor




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














                            • 1




                              Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: tio.run/…
                              – Jordan
                              Nov 16 at 16:04















                            up vote
                            3
                            down vote














                            Ruby, 56 45 bytes





                            ->a{a.permutation.map{|p|p.join.to_f}.minmax}


                            Try it online!



                            -11 bytes, thanks Jordan






                            share|improve this answer










                            New contributor




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














                            • 1




                              Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: tio.run/…
                              – Jordan
                              Nov 16 at 16:04













                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote










                            Ruby, 56 45 bytes





                            ->a{a.permutation.map{|p|p.join.to_f}.minmax}


                            Try it online!



                            -11 bytes, thanks Jordan






                            share|improve this answer










                            New contributor




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










                            Ruby, 56 45 bytes





                            ->a{a.permutation.map{|p|p.join.to_f}.minmax}


                            Try it online!



                            -11 bytes, thanks Jordan







                            share|improve this answer










                            New contributor




                            Travis 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 Nov 16 at 16:55





















                            New contributor




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









                            answered Nov 15 at 17:29









                            Travis

                            1313




                            1313




                            New contributor




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





                            New contributor





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






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








                            • 1




                              Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: tio.run/…
                              – Jordan
                              Nov 16 at 16:04














                            • 1




                              Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: tio.run/…
                              – Jordan
                              Nov 16 at 16:04








                            1




                            1




                            Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: tio.run/…
                            – Jordan
                            Nov 16 at 16:04




                            Nice work! You can save 2 bytes by dropping the parentheses around your argument (->a{...) and another 9 by using the handy minmax method: tio.run/…
                            – Jordan
                            Nov 16 at 16:04










                            up vote
                            2
                            down vote













                            Pyth, 13 12 bytes



                            hM_BSvsM.p`M


                            Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.



                            hM_BSvsM.p`MQ   Implicit: Q=eval(input())
                            Trailing Q inferred
                            `MQ Stringify all elements of Q
                            .p Generate all permutations of the above
                            sM Concatenate each permutation
                            v Evaluate each as a number
                            S Sort them
                            _B Pair the sorted list with its reverse
                            hM Take the first element of each, implicit print


                            Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p






                            share|improve this answer



























                              up vote
                              2
                              down vote













                              Pyth, 13 12 bytes



                              hM_BSvsM.p`M


                              Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.



                              hM_BSvsM.p`MQ   Implicit: Q=eval(input())
                              Trailing Q inferred
                              `MQ Stringify all elements of Q
                              .p Generate all permutations of the above
                              sM Concatenate each permutation
                              v Evaluate each as a number
                              S Sort them
                              _B Pair the sorted list with its reverse
                              hM Take the first element of each, implicit print


                              Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p






                              share|improve this answer

























                                up vote
                                2
                                down vote










                                up vote
                                2
                                down vote









                                Pyth, 13 12 bytes



                                hM_BSvsM.p`M


                                Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.



                                hM_BSvsM.p`MQ   Implicit: Q=eval(input())
                                Trailing Q inferred
                                `MQ Stringify all elements of Q
                                .p Generate all permutations of the above
                                sM Concatenate each permutation
                                v Evaluate each as a number
                                S Sort them
                                _B Pair the sorted list with its reverse
                                hM Take the first element of each, implicit print


                                Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p






                                share|improve this answer














                                Pyth, 13 12 bytes



                                hM_BSvsM.p`M


                                Outputs in form [smallest, largest]. Try it online here, or verify all the test cases at once here.



                                hM_BSvsM.p`MQ   Implicit: Q=eval(input())
                                Trailing Q inferred
                                `MQ Stringify all elements of Q
                                .p Generate all permutations of the above
                                sM Concatenate each permutation
                                v Evaluate each as a number
                                S Sort them
                                _B Pair the sorted list with its reverse
                                hM Take the first element of each, implicit print


                                Edit: Saved a byte by taking stringification out of the mapping function. Previous version: hM_BSmvs`Md.p







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Nov 15 at 12:39

























                                answered Nov 15 at 12:24









                                Sok

                                3,379722




                                3,379722






















                                    up vote
                                    2
                                    down vote














                                    Perl 6, 41 bytes





                                    {.max,.min}o+<<*.permutations.map(*.join)


                                    Try it online!



                                    Alternatives:



                                    {.max,.min}o+<<*.permutations.map:{.join}
                                    {.max,.min}o{[map +*.join,.permutations]}
                                    {.max,.min}o{+<<map *.join,.permutations}





                                    share|improve this answer



























                                      up vote
                                      2
                                      down vote














                                      Perl 6, 41 bytes





                                      {.max,.min}o+<<*.permutations.map(*.join)


                                      Try it online!



                                      Alternatives:



                                      {.max,.min}o+<<*.permutations.map:{.join}
                                      {.max,.min}o{[map +*.join,.permutations]}
                                      {.max,.min}o{+<<map *.join,.permutations}





                                      share|improve this answer

























                                        up vote
                                        2
                                        down vote










                                        up vote
                                        2
                                        down vote










                                        Perl 6, 41 bytes





                                        {.max,.min}o+<<*.permutations.map(*.join)


                                        Try it online!



                                        Alternatives:



                                        {.max,.min}o+<<*.permutations.map:{.join}
                                        {.max,.min}o{[map +*.join,.permutations]}
                                        {.max,.min}o{+<<map *.join,.permutations}





                                        share|improve this answer















                                        Perl 6, 41 bytes





                                        {.max,.min}o+<<*.permutations.map(*.join)


                                        Try it online!



                                        Alternatives:



                                        {.max,.min}o+<<*.permutations.map:{.join}
                                        {.max,.min}o{[map +*.join,.permutations]}
                                        {.max,.min}o{+<<map *.join,.permutations}






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Nov 15 at 15:06

























                                        answered Nov 15 at 14:58









                                        nwellnhof

                                        6,0481123




                                        6,0481123






















                                            up vote
                                            1
                                            down vote














                                            Husk, 10 bytes



                                            §,▼▲morṁsP


                                            Try it online or verify all!



                                            Explanation



                                            §,▼▲m(rṁs)P  -- example input: [2,3,1.1]
                                            P -- permutations: [[2,3,1.1],[3,2,1.1],[1.1,3,2],[3,1.1,2],[1.1,2,3],[2,1.1,3]]
                                            m( ) -- map the following
                                            (example with [1.1,2,3])
                                            ṁs -- | show each and join: "1.123"
                                            r -- | read: 1.123
                                            -- : [231.1,321.1,1.132,31.12,1.123,21.13]
                                            §, -- fork and join as tuple
                                            ▼ -- | min: 1.123
                                            ▲ -- | max: 321.1
                                            -- : (1.123,321.1)





                                            share|improve this answer

























                                              up vote
                                              1
                                              down vote














                                              Husk, 10 bytes



                                              §,▼▲morṁsP


                                              Try it online or verify all!



                                              Explanation



                                              §,▼▲m(rṁs)P  -- example input: [2,3,1.1]
                                              P -- permutations: [[2,3,1.1],[3,2,1.1],[1.1,3,2],[3,1.1,2],[1.1,2,3],[2,1.1,3]]
                                              m( ) -- map the following
                                              (example with [1.1,2,3])
                                              ṁs -- | show each and join: "1.123"
                                              r -- | read: 1.123
                                              -- : [231.1,321.1,1.132,31.12,1.123,21.13]
                                              §, -- fork and join as tuple
                                              ▼ -- | min: 1.123
                                              ▲ -- | max: 321.1
                                              -- : (1.123,321.1)





                                              share|improve this answer























                                                up vote
                                                1
                                                down vote










                                                up vote
                                                1
                                                down vote










                                                Husk, 10 bytes



                                                §,▼▲morṁsP


                                                Try it online or verify all!



                                                Explanation



                                                §,▼▲m(rṁs)P  -- example input: [2,3,1.1]
                                                P -- permutations: [[2,3,1.1],[3,2,1.1],[1.1,3,2],[3,1.1,2],[1.1,2,3],[2,1.1,3]]
                                                m( ) -- map the following
                                                (example with [1.1,2,3])
                                                ṁs -- | show each and join: "1.123"
                                                r -- | read: 1.123
                                                -- : [231.1,321.1,1.132,31.12,1.123,21.13]
                                                §, -- fork and join as tuple
                                                ▼ -- | min: 1.123
                                                ▲ -- | max: 321.1
                                                -- : (1.123,321.1)





                                                share|improve this answer













                                                Husk, 10 bytes



                                                §,▼▲morṁsP


                                                Try it online or verify all!



                                                Explanation



                                                §,▼▲m(rṁs)P  -- example input: [2,3,1.1]
                                                P -- permutations: [[2,3,1.1],[3,2,1.1],[1.1,3,2],[3,1.1,2],[1.1,2,3],[2,1.1,3]]
                                                m( ) -- map the following
                                                (example with [1.1,2,3])
                                                ṁs -- | show each and join: "1.123"
                                                r -- | read: 1.123
                                                -- : [231.1,321.1,1.132,31.12,1.123,21.13]
                                                §, -- fork and join as tuple
                                                ▼ -- | min: 1.123
                                                ▲ -- | max: 321.1
                                                -- : (1.123,321.1)






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Nov 15 at 17:36









                                                BMO

                                                10.5k21880




                                                10.5k21880






























                                                     

                                                    draft saved


                                                    draft discarded



















































                                                     


                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175999%2flargest-and-smallest-possible-number%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

                                                    Plaza Victoria

                                                    Puebla de Zaragoza

                                                    Musa