A competition to solve a particular problem through the usage and manipulation of strings.
6
votes
5answers
57 views
Convert Input to Direction
Challenge
Given input in the form <n1>, <n2> where number can be -1, 0, or 1, return the corresponding cardinal direction. Positive numbers move East in the x-axis and South in the y-axis,...
29
votes
13answers
2k views
Find the optimal pattern
Given a string s composed of lowercase letters, such as
aabaaababbbbaaba
and a positive integer n, such as 4, output a length-n string t such that when t is repeated to the length of s, they have as ...
14
votes
12answers
1k views
A, Buzz, C, D, E, Fizz, G
A simple FizzBuzz using strings.
Given
1 word or phrase (string)
2 unique characters
Output
The word or phrase with each occurrence of the first character replaced with fizz and each of the second ...
63
votes
34answers
11k views
Code Johnny Code, Code!
Rock-and-roll founding father Chuck Berry sadly passed away today.
Consider the chorus of his famous song "Johnny B. Goode":
Go, go
Go Johnny go, go
Go Johnny go, go
Go Johnny go, go
Go Johnny go, ...
30
votes
33answers
4k views
Is it true? Ask Jelly!
Background
Inspired by Octave's (and, by extension, MATL's) very convenient interpretation of truthy/falsy matrices, Jelly got the Ȧ (Octave-style all) atom.
Ȧ takes an array as input and returns 1 ...
26
votes
18answers
1k views
Abbreviate an array
Goal:
Given an array of strings, create abbreviated versions of each string.
Specification:
For this challenge, an abbreviation is the first N characters of a string. For the string abc: a, ab, ...
-4
votes
0answers
41 views
Program Not Assigning User Input to Array Subscripts [Java] [closed]
Novice programmer here. My program is supposed to utilise a for loop in which the user would input a team name, and then four team members, and then it would go to the second loop.
However when I ...
4
votes
2answers
210 views
Uni-Dimensional String Golf
Introduction
You have to simulate playing golf over an input string that represents the green. The 2-character substring () represents the hole, and is guaranteed to appear only once in the string.
...
2
votes
0answers
103 views
λ-calculus to js arrow notation transpiler [closed]
Not an interpreter. Arguably a compiler. But I'm talking about a transpiler.
It can be in any language, but it must return js-valid arrow notation code.
The λ-calculus string would be passed as an ...
18
votes
9answers
1k views
Sort useless characters
This challenge is inspired by this very nice answer by TidB.
In TidB's answer, every eight character is in the correct order: gnilwoB edoC (Code Bowling backwards). The other strings however are were ...
46
votes
23answers
6k views
Output the text “Code Bowling”
Code-Bowling
You've been hired by Brunswick Bowling to create a simple program to output the text Code Bowling on their monitors. This company is worth a pretty penny and you feel you can swindle ...
1
vote
0answers
120 views
Is one string contained within the other? [closed]
Given two inputs, you should print or return whether the characters in the first string are - in order - inside the second string.
For example, we want to check whether the string hello, taken as the ...
35
votes
10answers
4k views
Code golf for my real friends
...and real golf for my code friends.
This is a challenge based on a one year old XKCD comic which consists mostly of toasts (parodies of the first in the comic) following a distinct pattern, but ...
1
vote
1answer
103 views
CSV cleanup: remove all in col after ( [closed]
Problem
Given a file with:
56 (65%), 33(75%), , 44, "“hello”,(5) world", goodbye
89 (25%), 33(75%), , 44, "hello world", goodbye
92 (97%), 33(75%), , 44, "hello world", goodbye
Goal
Write back to ...
21
votes
3answers
534 views
[Br]eaking Code Golf [Ba]d
Consider the following string:
Tin Snips
This string contains several atomic symbols on the periodic table. We could rewrite this string to identify several of them:
[Ti][N] [Sn][I][P][S]
Of ...
20
votes
14answers
2k views
Bleeeet Bleeeet Bl Bleet!
(Meaning: Convert English to Bleet)
We have praised goats as god for years now.
But if we can't translate English to 'Bleet', the Goat God's language, we cannot communicate with them.
So, to ...
25
votes
14answers
1k views
Making Music Boxes
Your task is to take a sequence of characters (the music) as input (in a function or program), and print (or return) the music as it would look like in a music box.
You will only receive the ...
16
votes
10answers
975 views
Sign change, loop and display with minimal padding
Input:
Two integers: one negative, one positive.
Output:
On the first line output lowest to highest. On the second line we've removed the highest and lowest numbers and sign-changed all individual ...
18
votes
12answers
2k views
Verify the queens puzzle
If you don't know what a queen is in chess, it doesn't matter much; it's just a name :)
Your input will be a square of arbitrary width and height containing some amount of queens. The input board ...
12
votes
1answer
282 views
Convert λ-expressions to SK-expressions
The λ-calculus, or lambda calculus, is a logical system based on anonymous functions. For example, this a λ-expression:
λf.(λx.xx)(λx.f(xx))
However, for the purposes of this challenge, we'll ...
25
votes
15answers
2k views
Convert singular to plural
There are two forms of nouns, singular and plural. The conversion between these two is quite easy.
Normally, you end it with s. ex. car => cars.
If it ends with s,x,z,ch or sh, end it with es. ex. ...
9
votes
14answers
335 views
Find the frequency of triplets in a phrase
For context, this problem is based on a old chat-bot project I did.
Problem:
Given a string of words containing any of the characters:
" !\"#$%&'()*+,-./0123456789:;<=>?@...
25
votes
12answers
1k views
Find the original string, without the repetition without the repetition in the middle
Sometimes it happens that while typing a sentence, I am distracted and I end up typing the same couple of words twice couple of words twice in succession.
To make sure make sure other people are not ...
59
votes
33answers
6k views
Happy Birthday V!
Thanks to @KritixiLithos for helping me out with this challenge!
V is a programming language that I wrote so that I could use and extend vim for code-golf challenges. The very first commit was on ...
24
votes
7answers
716 views
Rotate a camera; save an Astronaut
Note: Minor spoilers for The Martian are in this challenge. Read ahead with caution
The Martian is a Science Fiction novel about astronaut and botanist extraordinaire, Mark Watney, who has been ...
11
votes
15answers
1k views
Simple CSV/DSV importer
Slightly more than an inverse of this.
In: Multi-line DSV data and a single delimiter character. The DSV may be taken as a file, a filename, line-break separated string, list of strings, etc. ...
49
votes
31answers
7k views
Print the Oscars Best Picture Winner
This challenge is in tribute to the winner of Best Picture at the Oscars 2017, La La Land Moonlight!
Your challenge is to print the text La La Land pause one second, then change the text to show
La ...
107
votes
31answers
21k views
La La Land… no wait, Moo Moo Moonlight
This challenge is a tribute to the winner of Best Picture at the Oscars 2017, La La Land Moonlight!
Write a function/program that takes a string containing only letters [A-Za-z], the three symbols ...
23
votes
3answers
382 views
Letter, Number, Symbol, Space, Repeat
There are 97 ASCII characters that people encounter on a regular basis. They fall into four categories:
Letters (52 total)
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Numbers or Digits (10 ...
20
votes
7answers
1k views
Lily pad jumping
In this challenge, you need to simulate a frog jumping back and forth on lily pads. The pond is infinitely big, has a line of an infinite number of lily pads, and the frog can jump across as many ...
-5
votes
1answer
111 views
Google search result short summary [closed]
Intro
When you search in google, it always shows you a result with a sample text from the found webpage.
For example if you search for "Madonna greatest vinyl", google will show you one line link, ...
14
votes
16answers
771 views
Number of string permutations that are palindromes
Your input will be a string consisting of small english letters.
Your task is to determine the number of distinct permutations of the original string that are a palindrome.
The input string has up ...
0
votes
11answers
229 views
In Soviet Russia, code writes you! [duplicate]
Input
Two words separated by a space. It is assumed that the first is a verb.
Output
The "Soviet counterpoint" to the input phrase, in the form of a punchline to an "in Soviet Russia" joke.
"break ...
84
votes
44answers
22k views
I'm a palindrome. Are you?
There have been a couple of previous attempts to ask this question, but neither conforms to modern standards on this site. Per discussion on Meta, I'm reposting it in a way that allows for fair ...
15
votes
20answers
841 views
Output Keystrokes
In any programming language, create a program that takes input and animates the text being typed on a keyboard.
The delay between each character should be varying to simulate true typing on a ...
13
votes
8answers
599 views
Help the grandparents find their password [duplicate]
Here's a scenario:
A grandmother and grandfather forget what their GMail password is. They know the word, but can't remember which letters are capitals.
The challenge is to take a word given and ...
24
votes
23answers
2k views
Recursive string substitution
The task
Write a program or function that given three strings A, B, C produces an output string where each instance of B in A has been recursively substituted with C.
Recursively substituting means ...
26
votes
44answers
3k views
As Easy As A-B-C
Input
A string that contains at most one of each of the letters A, B, and C. They may be in any order. The empty string is valid input.
Note: A previous version of this challenge used the letters ...
5
votes
1answer
212 views
Convert between Lambda Calculus Notations
The lambda calculus is a system of functional programming. Lambda calculus consists of variables, abstractions, and applications.
A variable is simply a name denoting a function parameter. It is a ...
25
votes
7answers
1k views
Convert braces to Right Hand Brace (Sad Brace)
Right hand brace is a style of code bracketing in which curly braces and semicolons are all aligned to a single point on the right side of a a file.
Generally, this is considered bad practice, for ...
36
votes
36answers
6k views
Animate the text in your terminal
Animate the text in your terminal
The goal
The goal is to "animate" the string "Hello world" in your output so that each character gets capitalised after each other.
Your program can exit after ...
27
votes
10answers
2k views
More fun with case-(very)-sensitive strings
Inspired by this challenge (or, more specifically, by misreading it), I've come up with the following challenge:
Given an input string S, reverse the order of all uppercase characters, and all ...
16
votes
5answers
343 views
Twisting Sentences
Rules
The program should receive a string/array of words as input. For each word in the string/array, it will reconstruct the word by taking characters in alternating fashion from the front and back ...
150
votes
41answers
26k views
Mathematics is fact. Programming is not
In mathematics, an exclamation mark ! often means factorial, and it comes after the argument.
In programming, an exclamation mark ! often means negation, and it comes before the argument.
For this ...
49
votes
22answers
2k views
Unscramble those case-(very)-sensitive strings
Goal
This is a simple challenge. Your goal is to unscramble a string by swapping each letter with the next letter of the same case, while leaving non-letter characters unchanged.
Step by step ...
18
votes
28answers
2k views
Count My Change
Your task is to sort an array containing the strings "quarter", "dime", "nickel", and "penny" any number of times in no specific order and sort them so that they are in this order: quarter dime nickel ...
7
votes
5answers
230 views
String truncation/summarization
Not entirely sure if this one or a similar challenge has already been posted, but here it goes anyway.
Write a program that takes a string as input and writes its trucated/summarized output form such ...
36
votes
18answers
5k views
Automate your first grade counting exercise
CodeGolf Challenge
PWSSHHHH! You wake up in a cryogenics lab in the year 3000. Upon being escorted to the assignment office to receive your career chip, presumably that of a delivery boy, a probe ...
1
vote
1answer
76 views
Letter Interpolate [duplicate]
This is a fairly simple challenge. Given a lower-case word, you must "interpolate" between letters. Here's some examples to hopefully clarify this:
Input: test
Output: tsrqponmlkjihefghijklmnopqrst
...
33
votes
45answers
3k views
Is this word Lexically Ordered?
Given an input string S, return truthy if all the letters in S are Lexically Ordered: their ASCII values need to be in either ascending or descending order. Return falsy in other cases.
Input
Input ...