Solved

Calculate the Levenshtein distance between two strings
This problem description is lifted from <http://en.wikipedia.org/wiki/Levenshtein_distance>. The Levenshtein distance betwee...

4 years ago

Solved

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

4 years ago

Solved

Replicate elements in vectors
Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2 3] -> [1 1 2 2 3 3] ...

4 years ago

Solved

Find a Pythagorean triple
Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them com...

4 years ago

Solved

Use a timetable to analyze a train timetable (Part 2)
Oh no, you missed your train to Boston! Find the departure time of the next available train by analyzing the train timetable. Yo...

4 years ago

Solved

"mirror" matrix
Create n x 2n "mirror" matrix of this type: Examples For n = 2 m = [ 1 2 2 1 1 2 2 1 ] For n = 3 m = ...

5 years ago

Solved

Generate this matrix
Generate the following matrix. n = 2; out = [-4 -3 -2 -1 0 -3 -2 -1 0 1 -...

5 years ago

Solved

Can the given sides form a triangle?
Can the three given sides form a triangle?

5 years ago

Problem

Convex Hull Capture
Imagine four points in uv that form a square. uv = [ ... 0,0; 0,2; 2,2; 2,0]; Now we have two more po...

5 years ago | 1 | 22 solvers

Solved

Combine the first and last names
MATLAB R2016 provides a rich set of functions to work with string arrays. In this problem, you will be given two string arrays o...

5 years ago

Solved

letter yes yes & letter no no
Split a string into two strings, wherein the first string has all alphabetic letters and the second string has all the remaining...

5 years ago

Solved

Union Jack Matrix
Create a matrix of odd dimensions that has ones on both diagonals and dividing the matrix into 4 quadrants, resembling a square ...

5 years ago

Problem

Count the Digits in the Box
In this problem you must provide an accurate census of all the digits inside a given box. The problem is complicated by the fact...

5 years ago | 3 | 6 solvers

Solved

Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

5 years ago

Solved

Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

5 years ago

Problem

When Was That Goal Scored?
We want to find out when the goals were scored in a particular soccer game. For each game, we are given a "Goal Event Data" XML ...

5 years ago | 2 | 81 solvers

Problem

Frobenius McNugget Factorization
Mr. Frobenius McNugget is a peculiar man. As you might expect, he likes to eat Chicken McNuggets. But his love of number the...

6 years ago | 15 | 18 solvers

Solved

Convert integer to base26 using letters
Write a function that converts a decimal integer to base26 using the letters of the english alphabet, i.e. 0->'a', 1->'b', 2->'c...

6 years ago

Problem

Breaking Bad Tiles (Spelling with Element Symbols)
Given a word, how you would spell it with element symbols from the periodic table? For instance, if given the string "Paper", yo...

6 years ago | 4 | 11 solvers

Solved

Number of occurrences of letter in a text
Given an input text either as a string or as a cell array of strings, return a (1 x 26) matrix containing the number of occurren...

6 years ago

Problem

Placing Beads Neatly in a Box
You are given a string of n black and white beads. Your job is to pack them neatly into a square box. "Neatly" in this case mean...

6 years ago | 7 | 12 solvers

Problem

Is It a Snake?
Given an m-by-n matrix, return true if the elements of the matrix are a connected "snake" shape from 1 to m*n. Otherwise return ...

6 years ago | 4 | 37 solvers

Solved

Replace secondary diagonal elements of a square array
Replace all the secondary diagonal elements of the square array A with the number n Example: A = [1 2 3 4 5 6 ...

6 years ago

Problem

Find the Final State of an Abelian Sandpile
Let us define an <http://nautil.us/issue/23/dominoes/the-amazing-autotuning-sandpile Abelian sand pile> as a matrix that is only...

6 years ago | 3 | 47 solvers

Solved

This is a palindrome and so am I
A palindrome is a sequence of characters which reads the same backward or forward, for instance 'a man a plan a canal panama'...

7 years ago

Problem

Fibonacci Decomposition
Every positive integer has a unique decomposition into nonconsecutive Fibonacci numbers f1+f2+ ... Given a positive integer n, r...

7 years ago | 11 | 360 solvers

Solved

Triangle sequence
A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

7 years ago

Solved

Pangrams!
A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

7 years ago

Solved

Prime Letters = Removing
Given a string, remove all the letters which in ASCII Code are prime numbers. For Example: s1 = 'Determine which array e...

7 years ago

Solved

pay it forward
Return any number (integer between 0 and 65535) You will pass this problem if you are the *second* person to choose that nu...

7 years ago