Linked Questions

76
votes
84answers
10k views

Count of “a”s and “b”s must be equal. Did you get it computer?

In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated: mainly because this language ...
75
votes
37answers
12k views

Non-discriminating Programming

We say a string is non-discriminating if each of the string's characters appears the same number of times and at least twice. Examples "aa!1 1 !a !1" is non-...
154
votes
16answers
27k views

Is My Swipe Pattern Legal?

Most Android smartphones allow the user to use a swipe pattern to open their phone: Certain patterns are legitimate, and others are impossible. Given an input swipe pattern, return a truthy or falsy ...
33
votes
77answers
4k views

Is this number a repdigit?

Challenge A repdigit is a non-negative integer whose digits are all equal. Create a function or complete program that takes a single integer as input and outputs a truthy value if the input number ...
76
votes
30answers
12k views

Create an “H” from smaller “H”s

Challenge Create a function or program that, when given an integer size, does the following: If size is equal to 1, output <...
44
votes
48answers
7k views

Is this string a square?

A string is considered to be square if the following conditions are met: Each line has the same number of characters The number of characters on each line is equal to the number of lines. Your task ...
35
votes
51answers
5k views

Zeroes at the end of a factorial

Write a program or function that finds the number of zeroes at the end of n! in base 10, where n is an input number (in any ...
40
votes
48answers
7k views

Am I an insignificant array?

An insignificant array is an array of positive integers, where the absolute differences between consecutive elements are all smaller than or equal to 1. For example, the following array is ...
37
votes
44answers
7k views

Kolmogorov shifter

Output or display the following three lines of text, exactly as they are shown below. A trailing newline is accepted. ...
41
votes
39answers
3k views

An Array of Challenges #1: Alternating Arrays

Alternating Arrays An alternating array is a list of any length in which two (not necessarily different) values are alternating. That is to say, all even-indexed items are equal, and all odd-indexed ...
34
votes
43answers
5k views

Yahtzee Small Straight Detection

In the game Yahtzee, players roll five six-sided dice, and attempt to create certain hands to score points. One such hand is a small straight: four consecutive numbers, not necessarily in order. The ...
43
votes
38answers
4k views

The Speed of Letters

Given a string as input, print a new string with each letter pushed to the right by its respective alphabet index. We all know that A is a slow and Z is a fast letter. This means that Z gets shifted ...
33
votes
38answers
2k views

Validate Random Die Tippers

Almost six years ago, fellow PPCG member steenslag posted the following challenge: In a standard dice (die) the numbers are arranged so that opposite faces add to seven. Write the shortest ...
25
votes
48answers
1k views

A list of number modulus their indices in the list

A simple one: Take a list of positive integers as input and output the numbers modulus their 1-based index in the list. If the input integers are ...
32
votes
29answers
4k views

Exploded substrings

Introduction Let's observe the string abc. The substrings that can be made from this are: a, ab, abc, b, bc, c We now need ...

15 30 50 per page