Questions tagged [string]

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

Filter by
Sorted by
Tagged with
27 votes
5 answers
4k views

Haplololololololology!

Haplology Haplology is a linguistic term: the omission of one occurrence of a sound or syllable that is repeated within a word, for example probly for probably. For this challenge, it means ...
21 votes
8 answers
3k views

ASCII-Art n'th Root

Challenge: Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal ...
26 votes
28 answers
2k views

Derivative of a product

In calculus, the derivative of a mathematical function defines the rate at which it changes. The derivative of a function f(x) can be marked as ...
  • 31.9k
21 votes
16 answers
4k views

Who needs 8 bits for one character?

Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed ...
  • 10.8k
11 votes
7 answers
648 views

Shortest restricted superstring

Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$. There are almost always multiple possible ...
  • 22.6k
19 votes
8 answers
2k views

Convert Alpha-3 to Alpha-2

I've been developing some programs involving me fetching a vector from a url using Alpha-2 country codes (such as GET /jp.svg for Japan). Except, oh no! All the ...
  • 451
14 votes
22 answers
2k views

Shift a string gradually

Given an input string and a wrapping string, find the location of the first input string char in the wrapping string and replace it with the wrapping string char 1 step to the right of that, find the ...
  • 3,129
8 votes
5 answers
887 views

Spell out an integer... in NDos' way

Objective Given a positive integer, spell it out in the conlang I made. Specification Let \$n\$ be the inputted integer. \$n\$ shall be spelled out in the following specification. The entire spelling ...
  • 4,173
16 votes
23 answers
2k views

Pair my brackets

Given a string consisting of ()[]{}, print the paired brackets in the same order as they appear in the string. Any opening bracket ...
  • 4,861
12 votes
18 answers
1k views

Words with Easy Letters in a Word Search

Introduction: Apparently I keep coming up with word search related challenges lately. :) When I do the word search in the Dutch news paper, some words are very easy to find because they contain ...
9 votes
5 answers
329 views

Convert the type modifiers from prefix to C-fix

Given a base type T, this can be augmented with * or [], each meaning pointer and array. For ...
  • 2,273
19 votes
8 answers
2k views

Optimally break a string into words

Given a string, like potatocarrot, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a ...
14 votes
8 answers
740 views

Organize a Kiowa library

We are probably all used to the English alphabetical order: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z When we compare words in English for the sake of ...
  • 90k
17 votes
17 answers
1k views

Play Caesar's Cipher with Letters only

Description The Caesar cipher is a cipher, where every letter in the alphabet will be rotated by a secret number. If the rotation is \$7\$, then a -> ...
  • 4,861
11 votes
19 answers
3k views

What's the Missing Code? (Robbers)

Robbers' Challenge Read the cops' challenge first. In this cops-and-robbers challenge, you (the robbers) must find the correct string of characters, which, when added into the cop's code, will make it ...
  • 837
26 votes
28 answers
4k views

What's the Missing Code? (Cops)

Cops' Challenge Robbers' challenge here. It has now been four days since the challenge was posted so all new answers should be marked as non-competing in the title. These answers can still be cracked ...
  • 837
13 votes
9 answers
1k views

Remove unmatched brackets

Inspired by @AviFS. Given a string containing brackets, e.g. [xyz]]abc[[def]hij[ You can parse through it with a stack of brackets. When you find an open bracket, ...
  • 31.9k
10 votes
8 answers
2k views

How many times do I break my own rule?

Introduction: In my recent Strikethrough the Word Search List challenge I mentioned the following: When I do the word-search puzzles, I (almost) always go over the words in order, and strike them ...
6 votes
15 answers
923 views

Spaceship shooter

Your task is to output a spaceship of size n with shooters/guns and n bullets of character - ...
  • 3,049
11 votes
14 answers
880 views

Arrange a Haft-Sin table

It's Nowruz and you want to set up a Haft-Sin table by words. This means finding seven words that start with letter s. The Challenge Write a program which its input is a list of words separated by ...
12 votes
14 answers
2k views

Sandbox overflow

Your task is to output a square sandbox of size n+2 with / characters in the corners and | ...
  • 3,049
10 votes
6 answers
423 views

The Missing Match

You are given a string of unknown length that contains a varied amount of (, {, [ and their ...
  • 451
25 votes
34 answers
5k views

Negative of an ASCII photo

Task Given an \$m\times n\$ binary ascii "photo", return the negative of the photo Example: ...
  • 1,201
12 votes
26 answers
1k views

Circular chained compound

Task Given a positive integer n, output the joined compound of circles The circles are of square of size n+2 but removing the ...
  • 3,049
3 votes
9 answers
1k views

int, float or neither?

Given a string, determine if it is an int, a float or neither. Examples 123 - int 62727.0033 - float 644c.33 - neither Your code should output a different value depending on which it is. For example ...
  • 1,071
26 votes
13 answers
874 views

Resolve references in a chat discussion

Sometimes in chat, if someone says something you agree with, you'll send a message with an ^, which points at the message above: ...
2 votes
5 answers
147 views

Generate this string table [duplicate]

For the given string s, generate generate a table like below. ...
  • 1,805
14 votes
16 answers
1k views

Building spikes

Inspired by this building (United States Air Force Academy Cadet Chapel, Colorado) Your task is simple, given a positive integer n, output the spiked building to ...
  • 3,049
12 votes
7 answers
667 views

S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ the Word Search List

Introduction: Every workday I read the newspaper in the morning while eating breakfast, and also do some of the puzzles at the back. When I do the word-search puzzles, I (almost) always go over the ...
15 votes
3 answers
355 views

What was my Wordle play?

Task Given a winning Wordle play results (clues), the target ("secret") word and a list of words, output a possible sequence of words leading to such results. The words in the list will be ...
  • 12.3k
12 votes
20 answers
1k views

Convert a string of ASCII characters to base-3 equivalents

Task similar to this one. Take a string of ASCII characters and convert it to base-3 equivalents separated by a space. For example: Hello, world! Should be ...
  • 1,805
21 votes
10 answers
1k views

Pretty print my arrays

I like to pretty print multidimensional arrays, like this: [ [ [1, 2, 3], [4, 5, 6] ], [ [7, 8, 9], [6, 4, 2] ] ] But it's a pain to do by hand and it'd ...
  • 31.9k
12 votes
7 answers
717 views

Knights Jam | Chess

The knight is a chess piece that, when placed on the o-marked square, can move to any of the x-marked squares (as long as they ...
  • 3,049
12 votes
5 answers
891 views

Simulating Bombs

More advanced version of this The aim of this puzzle is to simulate the impact of the shock wave of bombs on a square grid. The grid initially contains cells labelled ...
  • 3,049
16 votes
17 answers
1k views

Capture the longest leading whitespace substring from lines

The Challenge Given a multiline string, return the longest substring of leading whitespace present in every line, ignoring empty lines or lines composed only of whitespace. If input is empty or ...
12 votes
8 answers
815 views

Spinning Word Search

Introduction: Pete likes doing word search puzzles. Despite that, he has trouble searching for words vertically, (anti-)diagonally, or reversed. Because of that, he'll always search for the words left-...
5 votes
6 answers
2k views

Real-world progress bar

Backstory, skip if you like Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars ...
  • 9,228
16 votes
19 answers
1k views

Triangle Tripler

Simpler version of this Task You must create a program that outputs a triangle of a given size N. A triangle is made of 3 identical triangles A triangle of size N should be made of N lines A triangle'...
  • 3,049
20 votes
7 answers
2k views

Find my Māori pronouns

The Māori language has quite simple pronouns. It uses a single word for he/she/they/etc (ia), and the words for "you" and "me" are ...
  • 31.9k
22 votes
7 answers
851 views

Happy new year string builder

This question is inspired by this awesome answer. The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation ...
  • 2,869
7 votes
9 answers
2k views

Write a spam-detection program

You work for a social media platform, and are told to create a program in a language of your choice that will automatically flag certain post titles as "spam". Your program must take the ...
17 votes
6 answers
909 views

Retaining Water

Your task is to check the volume of water in a pool. Your have to create a program that takes in a input that is represented by an 10 by 10 grid of integers, with ...
  • 3,049
24 votes
17 answers
1k views

Find the index of the matching parentheses for each character

The challenge is simple, find the matching parentheses for every one of the parentheses in a given string input E.g. ()()() -> [1, 0, 3, 2, 5, 4] Always start ...
  • 3,049
47 votes
21 answers
7k views

Highlight a Wordle guess

In Wordle, you try to guess a secret word, and some letters in your guess are highlighted to give you hints. If you guess a letter which matches the letter in the same position in the secret word, the ...
  • 22.6k
14 votes
8 answers
625 views

Crack the Caesar cipher

The Caesar cipher is a simple and famous cipher, where the letters of the alphabet are rotated by some secret amount. For example, if our secret rotation is 3, we ...
  • 6,775
12 votes
10 answers
818 views

From code to golf (Cops' thread)

This is a cops-and-robbers challenge, the robbers' thread is here You can change the word code into golf by changing a letter at ...
  • 31.9k
17 votes
24 answers
1k views

Is this word in standard order?

Let \$ A \$ represent the alphabet, such that \$ A_1 = \$ a and \$ A_{26} = \$ z. Let's define that a word \$ W = w_1 w_2 ... ...
  • 22.6k
17 votes
44 answers
2k views

Remove odd indices and double the even indices

Your task is simple, just remove the odd indices and double the even indices Example the input is Hello, World! and we get indices ...
  • 2,555
13 votes
13 answers
2k views

Mat Printing Matrix

A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a ...
  • 3,049
15 votes
4 answers
324 views

Sides of a polygon

Given an ASCII-art shape made of the characters /\|_, your challenge is to return the number of sides it has. A side is a straight line of one of those, for example:...
  • 31.9k

1
2
3 4 5
43