556
\$\begingroup\$

This "sandbox" is a place where Code Golf users can get feedback on prospective challenges they wish to post to main. This is useful because writing a clear and fully specified challenge on your first try can be difficult, and there is a much better chance of your challenge being well received if you post it in the sandbox first.

Sandbox FAQ

Posting

To post to the sandbox, scroll to the bottom of this page and click "Answer This Question". Click "OK" when it asks if you really want to add another answer.

Write your challenge just as you would when actually posting it, though you can optionally add a title at the top. You may also add some notes about specific things you would like to clarify before posting it. Other users will help you improve your challenge by rating and discussing it.

When you think your challenge is ready for the public, go ahead and post it, and replace the post here with a link to the challenge and delete the sandbox post.

Discussion

The purpose of the sandbox is to give and receive feedback on posts. If you want to, feel free to give feedback to any posts you see here. Important things to comment about can include:

  • Parts of the challenge you found unclear
  • Comments addressing specific points mentioned in the proposal
  • Problems that could make the challenge uninteresting or unfit for the site

You don't need any qualifications to review sandbox posts. The target audience of most of these challenges is code golfers like you, so anything you find unclear will probably be unclear to others.

If you think one of your posts requires more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended! Be patient and try not to nag people though, you might have to ask multiple times.

It is recommended to leave your posts in the sandbox for at least several days, and until it receives upvotes and any feedback has been addressed.

Other

Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

To add an inline tag to a proposal, use shortcut link syntax with a prefix: [tag:king-of-the-hill]. To search for posts with a certain tag, include the name in quotes: "king-of-the-hill".

Get the Sandbox Viewer to view the sandbox more easily!

\$\endgroup\$
0

3988 Answers 3988

1
10 11
12
13 14
133
4
\$\begingroup\$

Find the index of the matching parentheses for each character

\$\endgroup\$
1
  • \$\begingroup\$ please check if i have explained properly as some may not understand \$\endgroup\$
    – DialFrost
    Feb 2 at 9:20
4
\$\begingroup\$

Find my Māori pronouns

\$\endgroup\$
0
4
\$\begingroup\$

Print 2^n graph in ASCII

Your challenge is to output this infinite graph:


o
o
oo
oo
oo
oo
ooo
ooo
ooo
ooo
ooo
ooo
ooo
ooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
oooo
ooooo
ooooo
ooooo
ooooo
ooooo
ooooo
...

with the xth line having floor(log_2(x)) os (or other characters). Tag: code-golf, ascii-art, kolmogorov-complexity.

\$\endgroup\$
3
  • \$\begingroup\$ wow this looks interesting tbh, is there supposed to be a \n at the start of the sequence? \$\endgroup\$
    – DialFrost
    Feb 12 at 13:48
  • 2
    \$\begingroup\$ @DialFrost Yeah, because floor(log_2(1)) = 0. \$\endgroup\$
    – null
    Feb 12 at 15:05
  • \$\begingroup\$ nice, but is there a reason you chose o? \$\endgroup\$
    – mathcat
    Feb 20 at 10:55
4
\$\begingroup\$

Is it a tower permutation?

\$\endgroup\$
2
  • \$\begingroup\$ Maybe add a link to your previous tower challenge? \$\endgroup\$
    – pxeger
    Feb 20 at 14:06
  • 1
    \$\begingroup\$ @pxeger I'll add a comment once I post this \$\endgroup\$
    – AnttiP
    Feb 20 at 14:07
4
\$\begingroup\$

Gambling with an Alien

Find the challenge here!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Welcome to code golf and thanks for using Sandbox! Are wee allowed to implement less restrictive output requirement, i.e. using our default decision-problem rules (tag wiki)? - I suggest it over using two fixed strings (that not all languages can handle). \$\endgroup\$
    – pajonk
    Feb 28 at 19:43
  • \$\begingroup\$ @pajonk That seems like a good change! I'll implement it. \$\endgroup\$
    – Groger
    Feb 28 at 19:45
4
\$\begingroup\$

Crate art stacking

\$\endgroup\$
4
  • \$\begingroup\$ Is trailing whitespace allowed? \$\endgroup\$
    – pajonk
    Mar 2 at 7:11
  • 1
    \$\begingroup\$ This one is much better than the Stack Em one. \$\endgroup\$
    – ophact
    Mar 2 at 8:40
  • \$\begingroup\$ @pajonk do you think its better to allow or not allow? \$\endgroup\$
    – DialFrost
    Mar 3 at 2:57
  • 1
    \$\begingroup\$ I think I usually see allowing trailing whitespace in such challenges. Also, I'm always on the side of loosening I/O requirements. \$\endgroup\$
    – pajonk
    Mar 3 at 7:28
4
\$\begingroup\$

Sorted strings filter

Input a list of strings a and a string s for search keyword. Find out all strings in a which contains s as subsequence. And sort them in the following order:

  1. Exact equals to s
  2. Starts with s
  3. Contains s as substring (continuous subsequence)
  4. Contains s as subsequence

Detail

  • When two strings belongs to the same group, you may sort them in any order you prefer.
  • String matching is case sensitive. "A" and "a" are different characters.
  • All strings will only contain printable ASCII (#32~#126).
  • All strings will not have leading or trailing whitespaces.
  • All strings will be non-empty.
  • List a does not contain duplicate strings.

Example

When the list is ["center","encounter","enter","enterprise","event"], and the search target is "enter", output should be ["enter","enterprise","center","encounter"]. "event" is not included in the output as it doesn't contain "enter" as subsequence.

Test cases

["center","encounter","enter","enterprise","event"]
"enter"
-> ["enter","enterprise","center","encounter"]

["celebration","cooperation","generation","operation","ratio"]
"ratio"
-> ["ratio","celebration","cooperation","generation","operation"]

["combination","explanation","international","nation","national","nomination"]
"nation"
-> ["nation","national","combination","explanation","international","nomination"]

["ever","every","here","very","where"]
"everywhere"
-> []

["interaction","traditional","train","training","transformation"]
"train"
-> ["train","training","interaction","traditional","transformation"]

["condition","confusion","construction","contribution","information","organization","recommendation","transportation"]
"onion"
-> ["condition","confusion","construction","contribution","organization","recommendation"]

["...","---",".-.-.-","..--","-..-"]
"--"
-> ["---","..--",".-.-.-","-..-"]

["#","##","###","####","#####"]
"####"
-> ["####","#####"]

Output from your program may be different from above test cases, as the order of words in same group is not required.

Rules

Input / Output

Input / Output are flexible. For example, you may use any reasonable ways including but not limited to:

  • You may I/O string as
    • Your languages built-in string in ASCII or any ASCII compatible encoding (e.g. UTF-8);
    • Your languages built-in string in any codepage that supports all printable ASCII characters (e.g. UTF-16);
    • NUL terminated array of characters;
    • array of integers, each integer is the ASCII value of character
    • 0 terminated integer array;
  • You may I/O the array of string as
    • A collection (OrderedSet, LinkedList, Array, ...; or HashSet only for input) of strings
    • A character (or ASCII value) matrix with 0 padding at the ending to each short ones;
      • Output matrix may have unnecessarily extra 0 padding;
    • Line break (CR / LF / CRLF) separated single string;
    • JSON encoded array of string

Meta: Is this clear enough? Any duplicate? Will it be interesting enough to post?

\$\endgroup\$
6
  • \$\begingroup\$ IMHO this would benefit from explicitly allowing or disallowing I/O as a list of char codes. \$\endgroup\$
    – pajonk
    Mar 9 at 13:10
  • \$\begingroup\$ @pajonk Included. Will it be helpful? \$\endgroup\$
    – tsh
    Mar 10 at 2:36
  • \$\begingroup\$ this challenge is quite interesting imo, but the bolding of words in the description might be abit hard to see (idk if you want to change it or leave it uty) but otherwise gd job on the challenge details! \$\endgroup\$
    – DialFrost
    Mar 10 at 2:44
  • 1
    \$\begingroup\$ @DialFrost Do you mean the example section? IMO, the bolding may be ignored and readers may still understand the question without them. So I think leave it as is should be enough. \$\endgroup\$
    – tsh
    Mar 10 at 2:55
  • \$\begingroup\$ ah ok @tsh sry my bad \$\endgroup\$
    – DialFrost
    Mar 10 at 2:59
  • \$\begingroup\$ @tsh Yes, thank you. \$\endgroup\$
    – pajonk
    Mar 10 at 5:27
4
\$\begingroup\$

Repeat List Until Longer

\$\endgroup\$
4
  • \$\begingroup\$ I think the output for the last example should be [2,3,5,2,3,5,2,3,5]? \$\endgroup\$
    – Dingus
    Mar 9 at 0:26
  • \$\begingroup\$ Ah yes, that was my muscle memory being a little off. Thanks. \$\endgroup\$
    – Seggan
    Mar 9 at 0:27
  • \$\begingroup\$ Suggestion: instead of second list as input take only its length. \$\endgroup\$
    – pajonk
    Mar 9 at 13:13
  • \$\begingroup\$ This problem is component of a solution for another problem. I prefer it like this. \$\endgroup\$
    – Seggan
    Mar 9 at 15:26
4
\$\begingroup\$

The Missing Match

\$\endgroup\$
5
  • \$\begingroup\$ The task becomes clear by the end but I think some reorganisation of the text would help. In the second sentence you say 'The braces are all balanced', but further down we find out that this isn't actually true: 'inside the string there is a single unbalanced brace'. I'd suggest these two bits of information should be closer together. \$\endgroup\$
    – Dingus
    Mar 13 at 2:26
  • \$\begingroup\$ @Dingus thanks for the feedback. I updated the answer; would you care to take a look? \$\endgroup\$
    – code
    Mar 13 at 3:25
  • \$\begingroup\$ Looks good to me, but one other thing - I'd suggest brackets is a more appropriate word than braces here. \$\endgroup\$
    – Dingus
    Mar 13 at 6:29
  • \$\begingroup\$ @Dingus sure, thanks! Do you suggest I post it anytime soon or wait another day or so? \$\endgroup\$
    – code
    Mar 13 at 6:54
  • \$\begingroup\$ The general recommendation is to leave it in the Sandbox a few days at least, just to maximise the number of eyes that see it before it goes on main. \$\endgroup\$
    – Dingus
    Mar 13 at 9:25
4
\$\begingroup\$

Can you decrypt me?

Cops

Cops, post obfuscated code that hides a number \$n\$ inside its code. If \$n\$ condchars are changed, the program outputs \$n\$. Otherwise, it outputs a different number. Both programs may not error.

Robbers

Find the chars to change and what they should change into.

Example

print(2)

N is 1.


Robbers' post:

print(1)

Scoring

Cops, the user with the most uncracked posts wins. Robbers, the user with the most cracks wins.

\$\endgroup\$
7
  • \$\begingroup\$ How could you stop robbers writes a code that try to apply cops code on every possible inputs until find out one matching output? \$\endgroup\$
    – tsh
    Mar 16 at 11:22
  • \$\begingroup\$ @tsh uh, can you clarify? \$\endgroup\$
    – Bgil Midol
    Mar 16 at 11:51
  • \$\begingroup\$ Does this mean robber just need to write a program that for (i in AllPossibleInputs) if (CopsCode(i) == CopsOutput) return i? \$\endgroup\$
    – tsh
    Mar 16 at 12:28
  • 1
    \$\begingroup\$ @tsh, is it possible to enforce "don't do that?" \$\endgroup\$
    – Bgil Midol
    Mar 16 at 13:11
  • \$\begingroup\$ This is a good format for a CnR, but you need to specify scoring criteria. For the cops, "shortest code" (code-golf) is probably good enough. For robbers, something like "most cracked answer". You should probably add a rule to allow uncracked cops' answers to become "safe" after a certain amount of time (probably around 1-2 weeks) \$\endgroup\$
    – pxeger
    Apr 12 at 9:01
  • \$\begingroup\$ @pxeger does it need more clarifying and details? (other then scoring criteria) \$\endgroup\$
    – Bgil Midol
    Apr 12 at 14:10
  • \$\begingroup\$ No, if you add those things, it will be ok \$\endgroup\$
    – pxeger
    Apr 12 at 14:47
4
\$\begingroup\$

What does the text talk about?

note that the machine-learning tag will be new

META: this is far from being done. I also understand that this challenge depends heavily on manual opinion about the "type" of a piece of text. Hence, if you take issue with that, I would appreciate your giving a comment that suggests ways to fix that issue, rather than an unjustified downvote related to that issue.

Additionally, this might be a duplicate. I would appreciate your pointing this out before I compile the list of texts, if possible. However, if you identify a duplicate after I start compiling the list of texts, that is also fine.

Some parts use the future tense to talk about what I will do. Obviously I will have done them by the time I post the challenge.

The sections in italic could be taken as being ambiguous.

The links to the training, validation and test sets are not available yet. And of course, I don't yet have labels on my side.


This is a project that I once attempted to do, having learned machine learning. I run a forum app, and I was thinking of incorporating my new machine learning knowledge into that app by creating a model that could detect topics related to a given topic. After having worked on it for a few days, I hadn't made much progress, so I abandoned it. I hereby challenge you to make a similar model, ideally with machine learning, but that is not required. Your model will classify the topic of a piece of text. Such a model could then be used to find text related to a given piece of text by finding texts with a similar topic. You can choose to write your model without machine learning.

This is thus essentially a machine learning challenge. (or ideally, it will be. You may choose to write your solution without machine learning, but I am mainly looking forward to seeing machine learning solutions.) I will provide a large set of "articles", divided into a training set, a validation set, and a test set, with a 60-30-10 split. I expect there to be about 500 articles in all.

The articles in the training and validation sets are labeled with their topics: for instance, history, geography, mathematics, programming, etc. The test set, importantly, does not have public-facing labels, but I have labels on my side.

The training set is available here.

The validation set is available here.

The test set is available here.

Challenge

Write a classifier that attempts to classify the topic of a piece of text. The possible topics are:

(coming soon)

You can choose any of (coming soon) distinct values to represent the topic.

It should be able to produce an output that is one, and only one, of the chosen distinct values given any input string.

You have access to the train set to teach your classifier to recognize the topics (if you are using machine learning). The validation set can be used to compare different approaches.

Your submission will be scored based on how well it does on the test set. I will write the test set articles in such a way that they are not ambiguous (500 years ago, a mathematician discovered a method to calculate integrals is ambiguous as the sentence could be about mathematics or history, but Learn about the way people lived 1000 years ago is only about history). Your score is the number of articles it can correctly classify out of the test set. The higher the number of articles your submission can correctly classify, the better the score is. Thus the winner of this challenge is the submission that classifies the most articles correctly.

Importantly, this is not . I expect this to be a challenge that demands significant time and effort to produce a solution that scores highly, so you may post a link to a GitHub repository hosting the solution if required.

You are encouraged to either provide a way to easily run your solution, or provide the list of outputs that your code produces when given the test set articles. Even better, you could post a Jupyter notebook (if you are answering with a supported language) containing your solution, complete with test set outputs.

Important: please do not post a solution that is optimized only for the test set. It should work reasonably well in general.

Just so that you can get an idea of the topics:

Article: The dinosaurs went extinct 66 million years ago due to an asteroid impact.
Topic: history

Article: Time complexity is a measure of the complexity of an algorithm. For instance, the operation of adding two integers is usually taken to have a complexity of O(1). The operation of summing a list given as input has a complexity of O(n) where n is the size of the input.
Topic: programming

Article: Partial derivatives are derivatives taken with respect to one variable.
Topic: mathematics

Article: Planes are for going on holiday, especially island getaways.
Topic: holiday

Article: Carrot Cake Potato Mushroom
Topic: food
\$\endgroup\$
1
  • \$\begingroup\$ [joke] mathematica probably has a builtin for this \$\endgroup\$
    – des54321
    May 2 at 18:54
4
\$\begingroup\$

Matrix Meets ASCII Art

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Is the input guaranteed to contain at least one 1? How should we handle all-0 rows? (will it ever be a case?) Are the 1s going to be always neighbours? I suggest adding some more examples/test-cases. \$\endgroup\$
    – pajonk
    May 9 at 11:05
4
\$\begingroup\$

Haplololololololology!

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Suggested test case: aaaabaaaab -> aaaab, as a simple example of matching the longest sequences not producing the shortest result (which would be abab) \$\endgroup\$ May 4 at 1:22
  • 2
    \$\begingroup\$ Thanks, added... \$\endgroup\$ May 4 at 1:27
  • 2
    \$\begingroup\$ What about something like filed edit? \$\endgroup\$
    – emanresu A
    May 4 at 5:45
  • 2
    \$\begingroup\$ It would yield filedit - or were you suggesting I add it to the test cases? \$\endgroup\$ May 4 at 5:51
  • 1
    \$\begingroup\$ Isn't mississippi -> missippi? \$\endgroup\$
    – pajonk
    May 4 at 12:55
  • \$\begingroup\$ Awesome, thank you! \$\endgroup\$ May 5 at 1:40
  • \$\begingroup\$ Edited down to a stub now that it's been posted to save space. \$\endgroup\$
    – Steffan
    May 13 at 4:04
4
\$\begingroup\$

Straighten my corners... diagonally

\$\endgroup\$
5
  • 1
    \$\begingroup\$ This is OEIS A060736. Sample Python copied from OEIS. \$\endgroup\$
    – Steffan
    May 22 at 23:14
  • \$\begingroup\$ Cheesy title suggestion: straighten my corners... diagonally \$\endgroup\$
    – chunes
    May 24 at 14:42
  • \$\begingroup\$ @chunes That sounds great, thanks! \$\endgroup\$
    – emanresu A
    May 24 at 19:33
  • \$\begingroup\$ Also, you probably realize this, but the question doesn't currently have a score criterion. \$\endgroup\$
    – chunes
    May 25 at 13:39
  • \$\begingroup\$ @chunes Nice catch, thanks :) \$\endgroup\$
    – emanresu A
    May 25 at 19:20
4
\$\begingroup\$

Make the list Fibonacci-like

\$\endgroup\$
4
\$\begingroup\$

Generate a Baudot punched tape segment

What is Baudot?

From Wikipedia

The Baudot code [boˈdo] is an early character encoding for telegraphy invented by Émile Baudot in the 1870s. It was the predecessor to the International Telegraph Alphabet No. 2 (ITA2), the most common teleprinter code in use until the advent of ASCII. Each character in the alphabet is represented by a series of five bits, sent over a communication channel such as a telegraph wire or a radio signal. The symbol rate measurement is known as baud, and is derived from the same name.

Task:

For this challenge, your task is to write a program or a function that takes a string as its input and generates ASCII art that looks like a roll of punched tape. For the purposes of this challenge, you should specifically use the following variant, as it just happened to be the first image I found :P

International Telegraph Alphabet 2 brightened

For example where input is "HELLO WORLD\r\n" (note that carriage return is optional)

 *    *      
  **  * **  *
.............
*    *  *    
    *  *   * 
* ***  *  *  
hello worldcl
           rf

Program Description:

  • The program/function takes the input and turns it into a sequence of Baudot words (sequences of five bits)
  • For each word, it makes a column of the first two bits, then a . then the remaining three bits
  • Optional trailing space / newline

Criteria:

  • Output may not be output as an array unless there is no other valid option in the language. Trailing spaces and newlines allowed.
  • Any acceptable input
  • Assume all input characters are valid Baudot characters
\$\endgroup\$
2
  • 2
    \$\begingroup\$ No need to specify standard loopholes and I/O, they apply by default. You also override standard I/O with your third rule, so not much of a point to linking to it. \$\endgroup\$ Jun 7 at 21:12
  • \$\begingroup\$ The Baudot code comes with the ability to switch between two modes (one for letters and one for figures). You'll have to clarify if we need to support that and how. \$\endgroup\$
    – Arnauld
    Jun 12 at 20:41
4
\$\begingroup\$

The Magic Money Machine

This KOTH is based on a game of Tom Scott's series Money, so make sure to check out his video


Challenge

There are three rounds per game. Each bot will get 100$.
They'll have to decide how much money they'll keep for themselves, and how much they're going to put in the Magic Money Machine.
The money in the Machine will get a 20% boost in the first round, a 50% boost in the second round, and a 100% boost in the third round.
Each bot will equally get the money left in the Machine.

Example:

  • Bot A decides to put 60$ in the Money Machine and keep 40$ for themselves
  • Bot B decides to put 30$ in the Money Machine and keep 70$ for themselves
  • In total there are 90$ in the Money Machine, so with a boost of eg. 20% that's 108$, so each bot will get an additional 54$
  • Bot A has 94$ in the end
  • Bot B has 124$ in the end

You have to try to get as much money as possible.

Rules:

  • Standard Loopholes apply
  • No interaction with the controller other than by returning values.
  • No interaction with other bots

API Template

def plan(round_num, others_money):
    # Tell the other bots how much money you're going to put in the Machine
    # You are allowed to lie
    return money_insert_pub

def main(round_num, others_money, others_plan):
    # Do stuff here
    return money_insert
  • round_num: an integer ranging from 1 to 3, it depicts the current round
  • others_money: a list of 0, 1, or 2 tuples. Each tuple will contain the money_kept var of the other bots of the last rounds (yours incl.).
  • money_insert_pub: the money_insert value you're telling others
  • money_insert: an integer between 0 to 100, the amount of money you put in the Magic Money Machine
  • others_plan: the money_insert_pub value of the other bots (yours incl.)

Controller code is on Github

Example bots

Beep Boopy Random

import random
def plan(round_num, others_money):
    global money_insert
    money_insert = random.randint(0, 100)
    return money_insert

def main(round_num, others_money, others_plans):
    return money_insert

Random copycat

import random
def plan(round_num, others_money):
    return 100

def main(round_num, others_money, others_plan):
    if round_num == 1:
        money_insert = random.randint(0, 100)
    else:
        money_insert = (
            random.choice(others_money[-1]) if others_money else random.randint(0, 100)
        )
    return money_insert

Meta

  • This is my first (well sort of) KOTH, is there anything I've missed?
\$\endgroup\$
5
  • \$\begingroup\$ Is the controller function written yet? You might want to link to it on Github. \$\endgroup\$
    – Steffan
    Jun 9 at 22:15
  • \$\begingroup\$ @Steffan not yet :P \$\endgroup\$
    – mathcat
    Jun 10 at 8:19
  • \$\begingroup\$ but now I'm done \$\endgroup\$
    – mathcat
    Jun 10 at 12:42
  • 1
    \$\begingroup\$ It looks like the bot that never donates will always win because "Each bot will equally get the money left in the Machine?" Am I missing something? \$\endgroup\$
    – Wezl oOvOo
    Jun 10 at 15:28
  • \$\begingroup\$ @WezloOvOo damn maybe one sec \$\endgroup\$
    – mathcat
    Jun 10 at 15:34
4
\$\begingroup\$

Give f and g that sometimes commute

\$\endgroup\$
8
  • \$\begingroup\$ @WheatWizard, how's this? \$\endgroup\$
    – cjquines
    Jun 11 at 19:15
  • \$\begingroup\$ Seems good. A little odd that when anonymous functions are only allowed for the separate submissions, but understandable. \$\endgroup\$
    – Wheat Wizard Mod
    Jun 11 at 19:36
  • \$\begingroup\$ What restrictions are there on the codomains of the functions? E.g. are \$f(x)=\frac32 x\$, \$f(x)=i^x\$, \$f(x)=\frac1{x^2}\$ valid? \$\endgroup\$
    – att
    Jun 11 at 22:05
  • \$\begingroup\$ @att by "over the integers", i mean that the domain and codomain are integers. i'll clarify. \$\endgroup\$
    – cjquines
    Jun 12 at 5:57
  • \$\begingroup\$ You've specified these functions to act on all integers, but it may be annoying for answers to handle negative numbers and/or zero. Is there a reason you don't restrict the input to positive integers, or allow answers to decide which of \$ \{ \mathbb Z, \mathbb Z^+, \mathbb Z^* \} \$ they handle? \$\endgroup\$
    – pxeger
    Jun 12 at 9:30
  • 1
    \$\begingroup\$ @pxeger no reason! i think the extra flexibility is okay. i'll edit the question so that people can choose, but i think it's still reasonable to require the domain and codomain to be equal (because these functions should be composed). \$\endgroup\$
    – cjquines
    Jun 12 at 17:56
  • \$\begingroup\$ Can I use builtins without explicitly declaring them? for instance, using \$f(x)=\text{abs}(x)\$, 0 bytes? Plus, why do I have to enter \$ here...? \$\endgroup\$ Jun 13 at 0:42
  • \$\begingroup\$ @NobodyNeedsNames at minimum you need to submit abs (like how other builtin submissions are) \$\endgroup\$
    – cjquines
    Jun 13 at 4:37
4
\$\begingroup\$

Iteratively delete a list

\$\endgroup\$
4
\$\begingroup\$

Universal Unicode Clock

\$\endgroup\$
4
  • \$\begingroup\$ How does this have to do with polyglot? \$\endgroup\$
    – Steffan
    Jun 11 at 20:09
  • \$\begingroup\$ @Steffan It's a program which runs on different versions of a library. So it's a sort of library polyglot. \$\endgroup\$
    – Wheat Wizard Mod
    Jun 11 at 20:10
  • \$\begingroup\$ If the Unicode handling library has an interface to determine which version of the Unicode database it uses, are we allowed to use that? \$\endgroup\$
    – pxeger
    Jun 12 at 15:21
  • \$\begingroup\$ @pxeger I'm not sure if there is really any point in disallowing it since it seems unlikely that it would get you many votes. \$\endgroup\$
    – Wheat Wizard Mod
    Jun 12 at 17:20
4
\$\begingroup\$

Extend a matrix in all directions

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Why is the second input another array, and not just the dimensions of the output array? \$\endgroup\$
    – pxeger
    Jun 14 at 16:00
  • \$\begingroup\$ @pxeger Good point \$\endgroup\$
    – emanresu A
    Jun 14 at 19:20
4
\$\begingroup\$

ro1000an nu1000era50 en100o501ng

\$\endgroup\$
1
  • 2
    \$\begingroup\$ I suggest adding a worked out example - the test cases were still confusing for me after reading the challenge body. \$\endgroup\$
    – pajonk
    Jun 25 at 13:48
4
\$\begingroup\$

Not-Roman-Numeral Addition

\$\endgroup\$
4
  • \$\begingroup\$ (from the test cases) How is 110015, ICIV, 94? IC is 99 + IV which is 4 should be 103. I'd suggest removing that test case though, because ICIV is not technically a valid roman numeral. \$\endgroup\$
    – Steffan
    Jun 26 at 3:06
  • \$\begingroup\$ The second-to-last test case is also wrong apparently: the second number is MMCCCXL which is 2340, not 2345, so the result is 3574 \$\endgroup\$
    – Steffan
    Jun 26 at 3:17
  • \$\begingroup\$ @Steffan fixed and fixed \$\endgroup\$
    – bigyihsuan
    Jun 26 at 6:53
  • \$\begingroup\$ this is basically roman numeral addition right? with translating before and after to numeric symbols \$\endgroup\$
    – qwr
    Jun 26 at 21:12
4
\$\begingroup\$

Word stays a word after taking away a letter

Posted here

\$\endgroup\$
2
  • \$\begingroup\$ Is it guaranteed that the input will contain a solution? \$\endgroup\$
    – pajonk
    Jul 1 at 12:36
  • \$\begingroup\$ @pajonk I think it's better to say no, thanks \$\endgroup\$
    – mathcat
    Jul 1 at 18:10
4
\$\begingroup\$

All Possible Ties in Tic-Tac-Toe

\$\endgroup\$
4
\$\begingroup\$

Next digit of rational number

\$\endgroup\$
4
  • \$\begingroup\$ A good test case might be 1.221122, which I believe should result in an output of 2 \$\endgroup\$
    – isaacg
    Jul 15 at 5:52
  • \$\begingroup\$ Good idea, added it \$\endgroup\$
    – Jiří
    Jul 15 at 10:08
  • \$\begingroup\$ Is the decimal separator important to the challenge? I feel like it might be better to just have no decimal separator \$\endgroup\$ Jul 16 at 4:19
  • \$\begingroup\$ @CommandMaster It isn't really that important, but I wanted the challenge make sense so this is why I kept it there. I expect that for most languages it will just be single replace, tr or something. \$\endgroup\$
    – Jiří
    Jul 16 at 14:36
4
\$\begingroup\$

Count the cells

\$\endgroup\$
4
\$\begingroup\$

Rearrange to a palindrome

Given a string, shuffle it so that it becomes a palindrome.

For example, adadbcc can be arranged into dacbcad, or dcabacd, acdbdca and more. Any of these (or all) is acceptable, and duplicates are allowed if outputting all. Something like abc cannot be shuffled into a palindrome, and you can assume it won't be inputted.

(if it helps) input will only contain lowercase letters.

Testcases

These show one possible solution.

nanas -> nasan
coconutnut -> conuttunoc
apotato -> atopota
manplancanalpanamaaaa -> amanaplanacanalpanama
canadadance -> canadedanac
\$\endgroup\$
0
4
\$\begingroup\$

Halve a string

Posted

\$\endgroup\$
2
  • \$\begingroup\$ If this was a decision problem, it would be easier to give test cases (because it would true/false instead of many different possible outputs) \$\endgroup\$
    – Fatalize
    Jul 19 at 12:46
  • \$\begingroup\$ I guess another possible task is to output the list of all halves of a given string. \$\endgroup\$
    – Fatalize
    Jul 19 at 14:20
4
\$\begingroup\$

Swap every two elements in the list every possible way

Posted

\$\endgroup\$
2
  • \$\begingroup\$ Welcome to the Code Golf SE! I have a few questions about your problem: 1) Should the output include the original order? Examples 2 and 3 do, but example 1 doesn't. 2) I might be mistaken, but isn't this equivalent to finding all permutations of the array? \$\endgroup\$
    – Adam
    Jul 23 at 20:13
  • \$\begingroup\$ @Adam 1) The output should include the original order only if the original order can be reached by applying every possible pair swap in some order. For example 1, the only possible swap just swaps two elements, and so only one permutation can be reached. For example 3, there is no possible swap, so the array stays the same, and for example 2, there are a lot of different possible results that happen to include the original order. 2) You are mistaken in that case. It isn't all permutations, it's slightly more complicated than that. It's a little bit of a research problem. \$\endgroup\$
    – Pavgran
    Jul 25 at 12:33
1
10 11
12
13 14
133

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .