Solved

Column Removal

Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; and ...

mer än 9 år ago

Solved

Connect Four Win Checker

<http://en.wikipedia.org/wiki/Connect_Four Connect Four> is a game where you try to get four pieces in a row. For this problem, ...

mer än 9 år ago

Solved

Longest Divisor Run

Given the vector a, find the longest run of consecutive numbers that can be evenly divided by the same number d where d > 1. ...

mer än 9 år ago

Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

mer än 9 år ago

Solved

Encode Roman Numerals

Create a function taking a non-negative integer as its parameter and returning a string containing the Roman Numeral representat...

mer än 9 år ago

Solved

Prime factor digits

Consider the following number system. Calculate the prime factorization for each number n, then represent the prime factors in a...

mer än 9 å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...

mer än 9 år ago

Solved

Tic Tac Toe FTW

Given a tic tac toe board: * 1 represents X * 0 represents empty. * -1 represents O It is X's move. If there is an imme...

mer än 9 å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...

mer än 9 år 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...

mer än 9 å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 ...

mer än 9 år ago

Solved

Maximum running product for a string of numbers

Given a string s representing a list of numbers, find the five consecutive numbers that multiply to form the largest number. Spe...

mer än 9 år 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...

mer än 9 år 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...

mer än 9 å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...

mer än 9 år 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...

mer än 9 år 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...

mer än 9 år ago

Solved

Determine if input is odd

Given the input n, return true if n is odd or false if n is even.

mer än 9 år 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...

mer än 9 år ago

Solved

Replace NaNs with the number that appears to its left in the row.

Replace NaNs with the number that appears to its left in the row. If there are more than one consecutive NaNs, they should all ...

mer än 9 å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...

mer än 9 år ago

Solved

Target sorting

Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

mer än 9 år 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 ...

mer än 9 år 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...

mer än 9 år 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...

mer än 9 år 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...

mer än 9 år ago

Solved

Find the sum of all the numbers of the input vector

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

mer än 9 år ago

Solved

Pizza!

Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

mer än 9 år ago

Solved

Fibonacci sequence

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

mer än 9 år ago