Solved

Sorted highest to lowest?

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

2 months ago

Solved

Find the stride of the longest skip sequence

We define a _skip sequence_ as a regularly-spaced list of integers such as might be generated by MATLAB's <http://www.mathworks....

2 months ago

Solved

"Look and say" sequence

What's the next number in this sequence? * [0] * [1 0] * [1 1 1 0] * [3 1 1 0] * [1 3 2 1 1 0] This a variant on the w...

2 months ago

Solved

Bang Bang in Bangalore

Imagine a strange language disorder, Bangolangosis, has developed among trigonometricians of <http://en.wikipedia.org/wiki/Banga...

2 months ago

Solved

Use of regexp

Given a string, containing several sentences, such as: 'I played piano. John played football. Anita went home. Are you safe?...

2 months ago

Question

How can I find consecutive digits seperated by spaces?

I am trying to use regexprep to replace a string sequence of numbers seperated by spaces by the quantity of consecutive numbers ...

2 months ago | 2 answers | 0

Solved

Is X a Fibonacci Matrix?

In honor of Cleve's new blog and post: <http://blogs.mathworks.com/cleve/2012/06/03/fibonacci-matrices/> Is X a Fibonacci ...

2 months ago

Solved

Integer sequence - 2 : Kolakoski sequence

Get the n-th term of <https://oeis.org/A000002 Kolakoski Sequence>.

2 months ago

Solved

Golomb's self-describing sequence (based on Euler 341)

The Golomb's self-describing sequence {G(n)} is the only nondecreasing sequence of natural numbers such that n appears exactly G...

2 months ago

Solved

Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)

Given a number _n_, return the terminal value of the number chain formed by summing the square of the digits. According to the P...

2 months ago

Solved

Sum of first n terms of a harmonic progression

Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....

2 months ago

Solved

Return the Fibonacci Sequence

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

2 months ago

Solved

Project Euler: Problem 2, Sum of even Fibonacci

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te...

2 months ago

Solved

Project Euler: Problem 6, Natural numbers, squares and sums.

The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

2 months ago

Solved

Alternating sum

Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...

2 months ago

Solved

QWERTY Shift Code Decoder

Decode a string encoded using the QWERTY shift code. QWERTY shift code is where the message was touch typed but with an offse...

2 months ago

Solved

Calculate the Hamming distance between two strings

Inspired by a similar Cody problem found <http://www.mathworks.com/matlabcentral/cody/problems/93-calculate-the-levenshtein-dist...

2 months ago

Solved

Without the French accent please!

Suppress the French accent. Example 'Déjà présent' -> 'Deja present'

2 months ago

Solved

Add more zeros

Find code that adds one 0 to each sequence of 0 in a string (composed with only 0 or 1). For example: '1010' -> '100100' ...

2 months ago

Solved

Ordinal numbers

Given an integer n, return the corresponding ordinal number as a character string. For example, ord(1)='1st' ord(2)=...

2 months ago

Solved

Guess Cipher

Guess the formula to transform strings as follows: 'Hello World!' --> 'Ifmmp Xpsme!' 'Can I help you?' --> 'Dbo J ifmq zpv...

2 months ago

Solved

There are 10 types of people in the world

Those who know binary, and those who don't. The number 2015 is a palindrome in binary (11111011111 to be exact) Given a year...

2 months ago

Solved

Find out sum and carry of Binary adder

Find out sum and carry of a binary adder if previous carry is given with two bits (x and y) for addition. Examples Previo...

2 months ago

Solved

Binary code (array)

Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector). Example: Inpu...

2 months ago

Solved

Converting binary to decimals

Convert binary to decimals. Example: 010111 = 23. 110000 = 48.

2 months ago

Solved

Convert given decimal number to binary number.

Convert given decimal number to binary number. Example x=10, then answer must be 1010.

2 months ago

Solved

Relative ratio of "1" in binary number

Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

2 months ago

Solved

Bit Reversal

Given an unsigned integer _x_, convert it to binary with _n_ bits, reverse the order of the bits, and convert it back to an inte...

2 months ago