Solved

Bullseye Matrix

Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

7 years ago

Solved

Getting logical indexes

This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

7 years ago

Solved

Subset Sum

Given a vector v of integers and an integer n, return the the indices of v (as a row vector in ascending order) that sum to n. I...

7 years ago

Solved

Find the two most distant points

Given a collection of points, return the indices of the rows that contain the two points most distant from one another. The inpu...

7 years ago

Solved

Duplicates

Write a function that accepts a cell array of strings and returns another cell array of strings *with only the duplicates* retai...

7 years ago

Solved

Extract leading non-zero digit

<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

7 years ago

Solved

Pattern matching

Given a matrix, m-by-n, find all the rows that have the same "increase, decrease, or stay same" pattern going across the columns...

7 years ago

Solved

Balanced number

Given a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to...

7 years ago

Solved

QWERTY coordinates

Given a lowercase letter or a digit as input, return the row where that letter appears on a <http://en.wikipedia.org/wiki/Keyboa...

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

The Goldbach Conjecture

The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

7 years ago

Solved

Cell joiner

You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

7 years ago

Solved

Counting Money

Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99. E...

7 years ago

Solved

Who Has the Most Change?

You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

7 years ago

Solved

Making change

Given an amount of currency, return a vector of this form: [100 50 20 10 5 2 1 0.5 0.25 0.1 0.05 0.01] Example: Input a = ...

7 years ago

Solved

Return the 3n+1 sequence for n

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

7 years ago

Solved

Find the alphabetic word product

If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

7 years ago

Solved

Triangle Numbers

Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

7 years ago

Solved

Summing Digits within Text

Given a string with text and digits, add all the numbers together. Examples: Input str = '4 and 20 blackbirds baked in a...

7 years ago

Solved

Sums with Excluded Digits

Add all the integers from 1 to n in which the digit m does not appear. m will always be a single digit integer from 0 to 9. no...

7 years ago

Solved

Quote Doubler

Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote ...

7 years ago

Solved

Trimming Spaces

Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32). Input a = ' singular value deco...

7 years ago

Solved

Remove NaN ?

input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

7 years ago

Solved

Remove all the consonants

Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

7 years ago

Solved

Volume of a sphere given its surface area

You just measured its surface area, that is the input.

7 years ago

Solved

Return the largest number that is adjacent to a zero

This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

7 years ago

Solved

De-dupe

Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

7 years ago

Solved

Sort a list of complex numbers based on far they are from the origin.

Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

7 years ago

Solved

Remove all the words that end with "ain"

Given the string s1, return the string s2 with the target characters removed. For example, given s1 = 'the main event' your ...

7 years ago

Solved

Simple date to serial no. conversion

Convert a date string to a serial date number. For example if you take x='19-May-2001' then the result is 730990 x...

7 years ago