Solved

Longest run of consecutive numbers

Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

plus de 6 ans ago

Solved

Create a Multiplication table matrix...

Create a product table in this format: P = [ 1 2 3 4 5; 2 4 6 8 10; 3 6 9 12 15; 4 8 12 1...

plus de 6 ans ago

Solved

Test if two numbers have the same digits

Given two integers _x1_ and _x2_, return |true| if the numbers written with no leading zeros contain the same digits. That is, t...

plus de 6 ans ago

Solved

Rank of magic square (for beginners)

Compute the rank r of a magic square of order n WITHOUT rank and magic functions.

plus de 6 ans ago

Solved

Two-output anonymous function?

Return a function handle that when applied to an input, it produces two outputs: the first is the same as the input, and the sec...

plus de 6 ans ago

Solved

Say something funny

Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

plus de 6 ans ago

Solved

Count up then down

Create a function that produces counting up from 0 up to n then down to 0 n=2 --> 0 1 2 1 0 n=3 --> ...

plus de 6 ans ago

Solved

Magic is simple (for beginners)

Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

plus de 6 ans ago

Solved

Replace multiples of 5 with NaN

It is required to replace all values in a vector that are multiples of 5 with NaN. Example: input: x = [1 2 5 12 10 7] ...

plus de 6 ans ago

Solved

Return 'on' or 'off'

When the input is true, return 'on', otherwise, return 'off'.

plus de 6 ans ago

Solved

We love vectorized solutions. Problem 1 : remove the row average.

Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

plus de 6 ans ago

Solved

Sophie Germain prime

In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

plus de 6 ans ago

Solved

Reverse the elements of an array

Reverse the order of elements in an array: eg: input X = [ 1 2 3 ; 4 5 6 ; 7 8 9 ] o...

plus de 6 ans ago

Solved

Property dispute!

Two neighbors have rectangular plots of land A and B. The surveyors give you the coordinates of each. If they overlap, there is ...

plus de 6 ans ago

Solved

Find out missing number from a vector of 9 elements

You are given a vector of size 9, x = [x1 x2 x3 x4 x5 x6 x7 x8 x9] Elements of x may be randomly selected without repeati...

plus de 6 ans ago

Solved

Detect a number and replace with two NaN's

Write code which replaces the number 1 with two NaNs. Example X = [ 1 2 NaN 4 1 3 7 NaN 1 4 NaN 2] ...

plus de 6 ans ago

Solved

Guess Cipher

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

plus de 6 ans ago

Solved

Create a random vector of integers with given sum

Your task today is to write a function that returns a vector of integer numbers, between, and including, 1 and m, of which the s...

plus de 6 ans 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...

plus de 6 ans ago

Solved

The Dark Side of the Die

It is well-known that opposite sides of a classic hexahedral die add to 7. Given a vector of dice rolls, calculate the sum of th...

plus de 6 ans ago

Solved

Largest Twin Primes

<http://en.wikipedia.org/wiki/Twin_prime Twin primes> are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Giv...

plus de 6 ans ago

Solved

Next Lower Power of B

Given a number _n_ and a base _B_ greater than 1, return the lowest integer power of _B_ that is less than or equal to _n_. E...

plus de 6 ans ago

Solved

Next Higher Power of B

|Given a number _n_ and a base _B_ greater than 1, return the lowest integer power of _B_ that is greater than or equal to _n_. ...

plus de 6 ans ago

Solved

I've got the power! (Inspired by Project Euler problem 29)

Consider all integer combinations of a^b and b^a for the integer values 2 ≤ a ≤ 4 and 2 ≤ b ≤ 5: 2^2=4, 2^3=8, 2^4=16,...

plus de 6 ans ago

Solved

Basics: 'Find the eigenvalues of given matrix

Find the eigenvalues y for a given matrix x.

plus de 6 ans ago

Solved

McCabe Complexity

The Challenge is to return the McCabe complexity for various functions. One way to determine the McCabe Complexity is to use ...

plus de 6 ans ago

Solved

Divisors of an integer

Given a number N, return a vector V of all integers that divide N. For example, N = 10 Then V=[1 2 5 10]

plus de 6 ans ago

Solved

Find Index of maximum Value and maximum Value of a vector

Find the Index of the first occurrence of the maximum value in a vector and also the maximum value in the vector. Example: [...

plus de 6 ans ago

Solved

Create a Cell array of month-end date strings within a date range

This is a variation of <http://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range Get...

plus de 6 ans ago

Solved

Create a Cell array of month-end date strings within a provided date range

This is a variation of <http://www.mathworks.com/matlabcentral/cody/problems/1039-get-an-array-of-month-ends-in-a-date-range Get...

plus de 6 ans ago