A competition to solve a particular problem through the usage and manipulation of strings.

learn more… | top users | synonyms

14
votes
8answers
1k views

Keep the unique characters down

It's very simple: Your program or function should generate the following text: Elizabeth obnoxiously quoted (just too rowdy for my peace): "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG," giving me a ...
30
votes
0answers
291 views

Language Design: 2-D Pattern Matching

This is Fortnightly Challenge #6. Theme: Language Design There's a chatroom for this challenge. Come and join us if you want to discuss ideas! And now for something completely different... This ...
6
votes
0answers
258 views
+50

Longest common substring

This challenge is about writing code to solve the following problem. Given two strings A and B, your code should output the start and end indices of a substring of A with the following properties. ...
7
votes
4answers
328 views

Prelude Syntax-Checker

Prelude is an esoteric programming language, which has very few, but unusual, restrictions on what constitutes a valid program. Any block of printable ASCII text ("block" meaning that lines of ...
23
votes
32answers
3k views

Check whether letters of word are in alphabetical order

Write a function/program that accepts a string of lower/uppercase letters [A-Za-z] as input, that checks whether the occuring letters are unique and in alphabetical order (ignoring lower and ...
20
votes
2answers
325 views

Golf Down the PPCG Usernames

A comment I made in chat and the ensuing conversation inspired me to make this challenge. Am I the only one referred to by initials around here? We are all about golfing things down. We can have ...
19
votes
6answers
1k views

A Mnemonic for Remembering 23940

The major system is a mnemonic device for converting numbers into words so they can be memorized more easily. It is based on how words sound phonetically, but to keep things simple for the challenge ...
-2
votes
4answers
126 views

Extract URI parts without using libraries [closed]

Given a URI like: postgres://username:password@hostname:PORT/dbname Extract it all into an array data-structure, like so: ['postgres', 'username', 'password', 'hostname', 'PORT', 'dbname'] More ...
3
votes
2answers
256 views

Generate unique non-sequential string of length n without memory of previously generated strings

Scenario: Imagine a situation where you wish to share a unique alphanumeric code. Perhaps it is a one-time-use coupon code you hand write on business cards, or some other scenario where it is ...
17
votes
34answers
3k views

Convert C header names to C++ header names

In the C standard library, header names end with a .h suffix: stdio.h In C++, those header names are available in an alternative form, with a c prefix instead: cstdio Write a function that ...
16
votes
8answers
1k views

Convert human readable time interval to date components

Challenge Write the shortest program that converts a human readable time interval to date components of the form: {±YEARS|±MONTHS|±DAYS|±HOURS|±MINUTES|±SECONDS} Sample cases Each test case is ...
8
votes
9answers
606 views

Find Privileged Substrings

Privileged Strings The set of privileged strings is defined recursively as follows. All strings of length 0 or 1 are privileged. A string s of length at least 2 is privileged, if there exists a ...
6
votes
2answers
160 views

String Equivalence: Counting Substrings

Background Two strings s and t are called k-Abelian equivalent (shortened to k-equivalent in the following) for a positive integer k if the following conditions hold: The length-k-1 prefixes of s ...
0
votes
0answers
66 views

Find the longest recurring substring [duplicate]

Given a string of no more than 255 characters, find a function that returns the longest recurring substring. An example would be: aabbacadeauaaabba where the longest recurring sub-string is ...
-4
votes
5answers
185 views

How many contiguous “strings” can you find in a set of strings?

Consider the set of 16-character strings containing only the 95 printable ASCII characters. There are 9516 ≈ 4.4×1031 such strings. Imagine these strings are put into a list and sorted ...
14
votes
15answers
2k views

Fill In the Blanks

Input A nonnegative integer n, and a nonempty string s containing only alphanumeric characters and underscores _. The first character of s is not _. The underscores of s are interpreted as blank ...
16
votes
7answers
1k views

Typing with scrambled keys

Your friend isn't too good with computers so as a practical joke someone scrambled the letters (a-z) on his keyboard. When he sit down and tried to type his name looking at the keyboard he realized ...
10
votes
11answers
597 views

Binary encryption

This is based on xkcd #153. Make a program or named function which takes 2 parameters, each of which is a string or a list or array of bytes or characters. The second parameter will only contain ...
23
votes
16answers
2k views

Shortest Unique Substrings

Input An alphanumeric string s. Output The shortest string that occurs exactly once as a (contiguous) substring in s. Overlapping occurrences are counted as distinct. If there are several ...
4
votes
3answers
360 views

Code Golf: Gibberish Echo

This is my first code golf challenge, as such I am not entirely certain if it is suitable as a Code Golf challenge, but it's all a learning experience. The challenge is that in as few characters as ...
-2
votes
2answers
159 views

Find Anagrams in the Dictionary [closed]

This a code challenge. The winner will be the person to provide the most efficient implementation of the solution in terms of algorithmic complexity. Using the dictionary found in '/usr/share/dict' ...
11
votes
22answers
1k views

String to Binary

This is a code golf challenge. Just like the title says, write a program to covert a string of ascii characters into binary. For example: "Hello World!" should turn into 1001000 1100101 1101100 ...
14
votes
17answers
2k views

Find the substring with the most 1's in a sequence

Introduction I want to find the substring with the most 1's in a sequence of 0's and 1's. Input Your program has two inputs, the sequence and the substring length. The sequence is any number of ...
6
votes
3answers
390 views

Retrograde morse (d)e(n)coder

This question is inspired by retrograde music. Retrograde music is a piece of music that can both be played normally (from the beginning to the end) as reversed (from the end the beginning). A similar ...
2
votes
1answer
109 views

String generator based on a wildcard [duplicate]

Your task, if you accept it, is to make a string generator that generates strings based on a wildcard. You can make a function or a full program that receives 1 argument and sends to the standard ...
12
votes
4answers
576 views

Write a Magic Spellchecker

The game Waving Hands is somewhere between a pen-and-paper Magic: the Gathering and a very elaborate Rock Paper Scissors. Each turn you write down one of eight gestures for each hand: wiggled ...
35
votes
9answers
2k views

Reverse indentation

I've heard that your code can run faster if you indent it in reverse, so that the compiler can process it like a tree design pattern from the very top of the "branches" down. This helps because ...
18
votes
9answers
1k views

Caesar-Cypher-Mania

The Caesar Cypher is a very simple substitution cypher where each letter is shifted by a fixed offset (looping around Z to A). Similarly, we can also a Caesar cypher for the set of printable ASCII ...
45
votes
20answers
5k views

Significant Whitespace

We define whitespace to be any of the three characters, tab (0x09), newline (0x0A) or space (0x20). For this challenge, you're to write two programs or functions in the same programming language, ...
16
votes
3answers
1k views

Distinguish between Masculine and Feminine Nouns in French within 100 characters

You are to write a very small program within 100 characters. Your program must distinguish between masculine and feminine french nouns. The output should be un if it is masculine and une if it is ...
10
votes
2answers
385 views

Concatenate Strings with Context

Strings with Context For the purposes of this challenge, a string with context is a triple of strings, called the left context, the data part, and the right context. It represents a substring of a ...
9
votes
15answers
2k views

Sum of strings without converting

You have to take 2 string inputs and output the sum of these two strings without converting them to int or using any numeric data type. ex. string one = "123"; string two = "456"; string sum = ...
11
votes
5answers
395 views

Generalized Gematria Calculator

Create a bidirectional Gematria calculator, for any given sequence of Unicode characters as the alphabet. Gematri-What? Gematria is a system of assigning numerical values to symbols, developed by ...
7
votes
2answers
315 views

Cyclically Equivalent Words

Cyclic Equivalence Let L be a list of pairs of letters, for example [(a,b), (a,c)]. We call L a list of commutators. Two words are cyclically equivalent over L, if one can be transformed into the ...
38
votes
7answers
3k views

Avoiding Rivers

Background In typography, rivers are visual gaps in a block of text, which occur due to coincidental alignment of spaces. These are particularly annoying since your brain seems to pick them up more ...
20
votes
7answers
1k views

Reassuring parables

Quite a few people here are probably avid XKCD readers. So, I figure I'd challenge you guys to do something that Megan can do easily: make a script that generates thousands of reassuring parables ...
4
votes
4answers
496 views

Find imperfect anagrams

The goal of this challenge is to write a program which takes a string (of any length) as input and displays anagrams (see these examples of anagrams) of this string, made by taking words in a ...
62
votes
93answers
16k views

Sing Happy Birthday to your favourite programming language

Your favourite programming language has just had a birthday. Be nice and sing the Happy Birthday song to him (or her, if you will). Of course you should accomplish this by writing a program in that ...
7
votes
8answers
842 views

Practical Golf - US States [closed]

My family has an e-commerce business. On our own site, we force people to choose their state from a dropdown menu when they enter their address, but through some other channels we use, customers can ...
7
votes
4answers
353 views

Line numbering - implement nl

Your task is to implement a program similar to the nl command-line tool from the GNU core utilities. Standard loopholes are banned. You may not use any built-in or external function, program or ...
2
votes
3answers
363 views

Let's play countdown!

For those of you who have seen the popular daytime TV show Countdown, you will know that the contestants are given 9 randomly selected letters and must then find the longest word they can in 30 ...
11
votes
19answers
3k views

Increment every number in a string

Given a string containing decimal numbers: teststring134this 123test string54 100 increment every number in this string by one to give the new string teststring135this 124test string55 101. The ...
5
votes
6answers
505 views

Find all strings at distance k

The edit (or Levenshtein) distance between two strings is the minimal number of single character insertions, deletions and substitutions needed to transform one string into the other. The challenge ...
8
votes
2answers
309 views

Rosetta Stone Challenge: Run-Length Encoding v2.0

The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! The Challenge We've done run-length encoding before but only ...
23
votes
9answers
2k views

Word Search Puzzle

Given a rectangular text as a word search puzzle and a search string, determine if the text contains the search string. The search string may appear: horizontally, vertically or diagonally forwards ...
13
votes
1answer
344 views

Minimal Boggle-like Arrangements

Consider how a word could be arranged on an arbitrarily large Boggle grid if the rule about not using the same letter cube more than once is ignored. Also assume that you have an unlimited number of ...
30
votes
14answers
3k views

String.prototype.isRepeated

UPDATE : isaacg's Pyth submission is the winner! Many of you must have heard that there is a cooler version of JavaScript in town (read ES6) which has a method String.prototype.repeat so that you ...
5
votes
0answers
201 views

Which positive integer is equal to it's own Scrabble score when spelt out in full? [closed]

The Challenge: Make the shortest program to confirm that 12 is the answer. (The puzzle is from Ian Stewart's "Cabinet of Mathematical Curiosities". This is my first code golf question. I hope this ...
21
votes
32answers
3k views

Generating a single string with an Oxford comma from a list

What are some clever (brief and idiomatic) approaches to taking a list of strings and returning a single properly punctuated string built from the list, with each element quoted. This came up for me ...
7
votes
3answers
903 views

Restricted memory optimization

The edit (or Levenshtein) distance between two strings is the minimal number of single character insertions, deletions and substitutions needed to transform one string into the other. If the two ...