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 ...

nästan 4 år ago

Solved

Find relatively common elements in matrix rows

You want to find all elements that exist in greater than 50% of the rows in the matrix. For example, given A = 1 2 3 5 ...

nästan 4 år ago

Solved

Pascal's Triangle

Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...

nästan 4 år ago

Solved

Reverse Run-Length Encoder

Given a "counting sequence" vector x, construct the original sequence y. A counting sequence is formed by "counting" the entrie...

nästan 4 år ago

Solved

Which doors are open?

There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

nästan 4 år 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 = ...

nästan 4 år ago

Solved

What is the next step in Conway's Life?

Given a matrix A that represents the state of <http://en.wikipedia.org/wiki/Conway's_Game_of_Life Conway's game of Life> at one ...

nästan 4 år ago

Solved

Counting Sequence

Given a vector x, find the "counting sequence" y. A counting sequence is formed by "counting" the entries in a given sequence...

nästan 4 år ago

Solved

Scrabble Scores

Given a word, determine its score in <http://en.wikipedia.org/wiki/Scrabble Scrabble>. The input string will always be provi...

nästan 4 år 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...

nästan 4 år ago

Solved

Kaprekar Steps

6174 is the <http://en.wikipedia.org/wiki/6174_%28number%29 Kaprekar constant>. All natural numbers less than 10,000 (except som...

nästan 4 år ago

Solved

Find the peak 3n+1 sequence value

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...

nästan 4 år ago

Solved

Read a column of numbers and interpolate missing data

Given an input cell array of strings s, pick out the second column and turn it into a row vector of data. Missing data will be i...

nästan 4 år ago

Solved

Interpolator

You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

nästan 4 år ago

Solved

Implement a ROT13 cipher

Replace each character in string s1 with the character that is shifted 13 positions from it (wrap back to the beginning if neces...

nästan 4 år ago

Solved

Test for balanced parentheses

Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

nästan 4 år ago

Solved

Mandelbrot Numbers

The <http://en.wikipedia.org/wiki/Mandelbrot_set Mandelbrot Set> is built around a simple iterative equation. z(1) = c z...

nästan 4 år ago

Solved

Remove the small words from a list of words.

Your job is to tidy up a list of words that appear in a string. The words are separated by one or more spaces. Remove all words ...

nästan 4 år ago

Solved

It dseon't mettar waht oedrr the lrettes in a wrod are.

An internet meme from 2003 (read more <http://www.snopes.com/language/apocryph/cambridge.asp here>) asserted that readers are re...

nästan 4 år ago

Solved

Counting in Finnish

Sort a vector of single digit whole numbers alphabetically by their name, in Finnish. See the Wikipedia page for <http://en.wik...

nästan 4 år ago

Solved

Get the area codes from a list of phone numbers

Given a string of text with phone numbers in it, return a unique'd cell array of strings that are the area codes. s = '508-6...

nästan 4 år ago

Solved

Count from 0 to N^M in base N.

Return an array of numbers which (effectively) count from 0 to N^M-1 in base N. The result should be returned in a matrix, with ...

nästan 4 år ago

Solved

Check to see if a Sudoku Puzzle is Solved

*Description:* Your task, should you choose to accept it, is to make a function that checks to see if a 9x9 matrix of integer...

nästan 4 år ago

Solved

Geometric series

Find the sum, given the first term t1, the common ratio r, and number of terms n. Examples If input t1=1, r=1, n=7 the...

nästan 4 år ago

Solved

Read a Soroban Abacus

*Description* The Soroban is the name of the modern Japanese abacus. Information on reading a Soroban can be found <http://we...

nästan 4 år ago

Solved

Cannon Ball

Given g (acceleration due to gravity) and desired altitude x, find the minimum ground velocity of a cannon ball to reach x.

nästan 4 år ago

Solved

Increment a number, given its digits

Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

nästan 4 år ago

Solved

Reverse Boggle

*Description* In the classic Parker Brothers game <http://en.wikipedia.org/wiki/Boggle Boggle>, players find words from a 4x4...

nästan 4 år ago

Solved

Equidistant numbers containing certain value in an interval

Given a lower and upper bound of an interval, distance between numbers, and one particular number from that interval, create an ...

nästan 4 år ago

Solved

High school cafeteria

Given an input vector of positive integers, return a row vector with the primes first (in increasing order) and the composites n...

nästan 4 år ago