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 ...
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 ...
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: ...
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 ...
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 ...
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} & {\...
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 ...
3k views

### Bitflip and negate

Given an integer, make an expression that produces it from 0 using unary negation - and bitwise complement ...
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: ...
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 ...
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 ...
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 ...
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 ...