Doge Ruby
First you must run this setup code
class Array;alias ruby sort;end
def self.method_missing x,*a;x;end
def very x;$a=x;end
def many x;$b=$a.send x;end
def wow;puts $a==$b;end
Then just store the array in a variable called coding
and run:
very coding
many ruby
so algorithm
wow
And your answer will be printed (true or false).
Please also add the doge code for optimal performance:
#~! SET DOGE=1 PERFORMANCE=OPTIMAL ONERROR=nil PIC=
# ***=*
# **===*
# ***=-=& &&**&
# **==--= ***===*
# &***=---* $*=------*&
# &***=---=* $**=----;;=&
# &**==----=& &*===---;;;-*
# &**==----=* &**=-==--;;;;=
# ****=-----=* &&*==--=---;;;;-
# **===------=& $&*==-------;;;;-
# **===-------=*&$$ &*==------;;;;;;;-
# **==----==-====***&&&&&&&&$$ &*==-;;---;;;;;;;;-&
# &*=---=====================*******=---;---;;;;;;;-;;=
# *=======*=========================---;;--;;;;;;;;;;;*
# *===***=======================------;;--;;""""";;;;;=
# *=*****========================;--;;;;--;;""""";;;;;*
# &*********====-----===============;;;;;----;"","";-;;-&
# ***********====----================-;;;;----;",,";;----
# &************===---====================-;;;;;;",,"";----=
# &*************===---=====================-;;;;",,,";-----*
# ******=*******===--=======================--;",,,"";-----&
# &**************==--=========================-;"","";----;-
# ****************==---====****=====-===========--;";;-;;;";=
# ****************==----==*******===--=============--;----;--=
# &*****=;"";==***===----==*******===----=============------;-=$
# &&&***;"",,"-**====---==********=====-===============----;;;-&
# &&&&&*=-;;";";*==========****=***======--=========***==---;;;-&
# $&&&&&&=="",,,-===**=======***==-;-=================**===--;;;;*
# &&&&&&&-="",,"==***==***======-",,,";=-===================--";;=
# &&&&&**=-""";==****=***===---;"-=-,,,"--===================-;;;=&
# &&&&&&***--;=***********=---;,,-*",,,,,"--==================--;--*
# &&&&&***=*=*************=-;;","=-,,,,,,"-====================----=$
# &&&&&&*******************==--","-;,,,,,"-====*****=============-===&
# $&&&&&&******************===---",";"""";=******************=====-===*
# &&&&&&&&&*****************======--;;--==********************=========&
# &&&&&&&&&&&******=**********===========*==*****&&************=========*
# &&&&&&&&*=---;--==**********==============*********************=======*&
# &&&&&&&-""""";;"";=**********==**=========*****&&&**************=======*
# &&&&&&&*,,,,,,,,,,,"-****&************=*******&&&&&&&************========&
# &&**&&&=,,,,,,,,,,,,;*&&&&***********************&&&&&&***********=======*
# &&&*&&&*",,,,,,,,,,,;*&&&*************&&**********&**************========*&
#&&&&&&&&-"",,,,,,,,,,-*&&&**********&**&&&&&&&******************==========**
#&&&&&&&*=,,,,,,,,,,,"-***************&&&&&&&&&*****************====--======*&
#&&***&&*=;,,,,,,,,,";=*==*****************&&&***************=======--=======&
#*&&&&**=-;",,,,,,"";-=*********=**&*********&&**************=======--======**
#&&&&&**=-""",,,,,"";==**==***===**********************======***===---=======*&
#&&&&&**=-;"""""","";;=-===*======*********************==******====----======*&
#*&&&&**=-;""""""""";=-============*****************==*********====---==--===**
#&&&&&***=",,,,,,"""";--=============*******==****************====----=--====**&
#&&&&&****"",,,,,,,,,;-=========--===****====******************====--==-======*&
#&&&&&&&&*-"",,,,,,,,,"--==--;"""";====**===********************======--======**
#&&&&&&***=-;",,,,,,,,,,,;",,,""";-=======********************===-------=======*
#&&&&&&&****=;""""""""",,,"""";;--==**====*******************=====--------=====*
# &&&&&&&***=-;;;;;;;;;"";;;;;---==***====*****************=====--=--------====*$
# &&&&&&*****=-;-----=--------=====*=======****************====-==---------=====&
# &&&&&******==-==-=============***========*************======----=--------====&
# &&&&************==========================***********=====----------------===*
# $&&&&***************====================***********=*======-------------=--==*
# &&*&************=====================**************======--------------=====*
# &******************=================**************=========-----------======*
# &***********=*****================************==========------;-------=====*
# &*****************================***********=============---------========*
# &*************===================**********==***========--------========***
# **************==================********====**===*=====--------=======****
# &************=============================*****=*=====--------=======*****
# &****=*******=============================**============--=======*=******
# $*****=====**===========================***===================**********&
# &*****=====================-====-====*=*=====*=======--==***************
# &*****===========---==--===============**=**=*========*****************
# &*****====---=---------========********======***===*******************
# *****=======-=-------======*******=**==****==*==*********************
# $***======================******===**********************************
# &***===================*******==***=******************************=&
# &***=========-=========*************==***************************=&
# ******===*=======*=*****************==*************************==&
#~! END
This is the easiest way.
(the ASCII art was generated by a script I wrote up, derived from this image.)
1
possible duplicate of I need a program where the user inputs an array of doubles and the program outputs the array sorted
– None – 2014-02-27T16:56:04.23758This is not a duplicate. Some moderators feel it necessary to mark every question duplicate to others without reading it. This is not a sorting question at all. Read it. – microbian – 2014-02-27T17:16:54.227
3At the end of the contest I would like to know the "creative" solution, too! :) – Vereos – 2014-02-27T17:23:56.980
1@microbian why do you think that this guy is a mod? – Mhmd – 2014-02-27T17:39:11.697
1Because you get mod privileges after certain reputation (i think 500) and you see option to close questions. – microbian – 2014-02-27T17:40:32.970
16@micro Diamond moderators are community elected. You are confusing moderators with the privilege system. – Doorknob – 2014-02-27T17:58:36.163
3@microbian So have you hired that guy? – VisioN – 2014-02-28T08:17:21.850
I am confused, do you want 1) creative answers to determine whether an array is sorted (regular popularity contest), 2) bad, deconstructive or cheating solutions to task of checking whether an array is sorted (regular code trolling) or 3) bad, deconstructive or cheating solutions to task of checking in a creative manner whether an array is sorted (code trolling of case 1)? To me it reads like the latter, but that’s unlikely a good task. – Wrzlprmft – 2014-02-28T11:44:16.290
1https://xkcd.com/1185/ – TheDoctor – 2014-02-28T23:29:03.577
3If only StackExchange API allowed write access, I'd ask the question "Is this array sorted?" and count upvotes on positive/negative answers.. – Michael Foukarakis – 2014-03-01T08:31:05.367
Good start of a recursive solution?
shellsorted?
Ouch. – Henk Langeveld – 2014-03-01T11:09:30.107Did you tell the guy it has to fast. – PyRulez – 2014-03-02T02:36:23.540
@microbian Gaining privileges does not make you a mod, mods have a diamond next to their name and extra "powers" that normal users cannot get through privileges. – Izkata – 2014-03-02T04:55:22.110
Just for clarification, had you asked the candidate for a creative solution? Was this a good answer to your question (to see if the candidate could think outside the box) or were you shocked because you were expecting something more... useable? – Reinstate Monica -- notmaynard – 2014-03-03T15:52:51.830
1No, I did not ask for any out of the box solution. I just asked the plain question. He said this is the only solution he could think of. – microbian – 2014-03-03T16:16:43.090
Well that made no sense then. Why would you go for O(n2) solution while O(n) solution would do just the thing and is obvious. – Manish Shukla – 2014-03-05T06:09:26.747
Code-trolling is in the process of being removed, as per the official stance. This question is very highly voted with many highly voted answers, and recieved over 50% "keep" votes on the poll, so I am locking it for historical significance.
– Doorknob – 2014-05-10T16:11:58.653