Linked Questions

28
votes
51answers
4k views

The Squiggly Sequence

All credits to Adnan for coming up with this challenge. My last challenge, before I go on break. Task Given positive integer n, if ...
30
votes
49answers
5k views

Simulating Exploding Dice

Your task is to make a program that takes in an integer n > 1, and outputs the roll of a single n-sided die. However, this ...
45
votes
36answers
4k views

Increment an Array

Given a nonempty array of positive integers, "increment" it once as follows: If all the array elements are equal, append a 1 to the end of the array. For example: ...
27
votes
56answers
3k views

Trim the array!

Given an integer array and two numbers as input, remove a certain amount of the first and last elements, specified by the numbers. The input can be in any order you want. You should remove the first ...
33
votes
41answers
6k views

Return the Closest Prime Number

Challenge This is a simple one: Given a positive integer up to 1,000,000, return the closest prime number. If the number itself is prime, then you should return that number; if there are two primes ...
40
votes
32answers
3k views

Remove surrounding zeroes of a 2d array

This is a 2-dimensional version of this question. Given a non-empty 2-dimensional array/matrix containing only non-negative integers: $$ \begin{bmatrix} {\color{Red}0} & {\color{Red}0} & {\...
31
votes
38answers
4k views

Calculate Euler's totient function

Background Euler's totient function φ(n) is defined as the number of whole numbers less than or equal to n that are relatively ...
42
votes
29answers
3k views

Bitflip and negate

Given an integer, make an expression that produces it from 0 using unary negation - and bitwise complement ...
30
votes
36answers
5k views

Fibtraction - Fibonacci but with subtraction [duplicate]

The Fibtraction sequence (as I call it) is similar to the Fibonacci sequence except, instead of adding numbers, you subtract them. The first few numbers of this challenge are: ...
20
votes
49answers
3k views

Count the changes in an array

Your task today is to write a program or function that takes an array of integers, and counts the number of times, reading it left to right, that the value changes. This is easier to show with an ...
26
votes
43answers
5k views

Diamond creator +

Challenge : Given an integer n as input. Create a diamond that is 2x the given number n. Input : Input is integer ...
24
votes
43answers
4k views

Character Frequency in a String [duplicate]

Given a string of printable ASCII, output the frequency of each character in that string. The Challenge Input is given as a string of printable ASCII characters (decimal ...
25
votes
42answers
3k views

Write a domino effect

Using the fewest Unicode characters, write a function that accepts three parameters: Total number of dominoes nth affected domino Topple direction of the affected ...
28
votes
36answers
3k views

Find the unique twins

You will be given two Arrays / Lists / Vectors of non-negative integers A and B. Your task is to output the highest integer N that appears in both A and B, and is also unique in both A and B. You ...
31
votes
31answers
4k views

Greatest common substring

Create a program or function which takes a list of strings as input, and outputs the longest string that is a substring of all input strings. If there are several substrings of equal length, and no ...

15 30 50 per page
1
2
3 4 5
8