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

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

ongeveer 7 jaar ago

Solved

Is my wife right? Now with even more wrong husband

Again, as in "Is my wife right?" ( <http://www.mathworks.com/matlabcentral/cody/problems/149-is-my-wife-right> ), answer 'yes' r...

ongeveer 7 jaar ago

Solved

Roll the Dice!

*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

ongeveer 7 jaar ago

Problem

Elapsed time is -0.005204 seconds.

Write a function that takes less than zero seconds to execute, as measured using tic and toc. For repeatability, the test case p...

ongeveer 7 jaar ago | 5

Solved

Elapsed time is -0.005204 seconds.

Write a function that takes less than zero seconds to execute, as measured using tic and toc. For repeatability, the test case p...

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

ongeveer 7 jaar ago

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

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

ongeveer 7 jaar ago

Problem

Exact binary matrix factorization

Given a binary-valued (only ones and zeroes) MxN matrix C, and K (where K<M and K<N) find a binary-valued MxK matrix A and a bin...

ongeveer 7 jaar ago | 0

Solved

Exact binary matrix factorization

Given a binary-valued (only ones and zeroes) MxN matrix C, and K (where K<M and K<N) find a binary-valued MxK matrix A and a bin...

ongeveer 7 jaar ago

Solved

Sum all integers from 1 to 2^n

Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

ongeveer 7 jaar ago

Solved

Which values occur exactly three times?

Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

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

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

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

ongeveer 7 jaar ago

Solved

Remove the vowels

Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

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

ongeveer 7 jaar ago

Solved

Back and Forth Rows

Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

ongeveer 7 jaar ago

Problem

Path of least resistance

Find the length of the shortest path through the matrix from the top left to bottom right corner. You may move right, down, or d...

ongeveer 7 jaar ago | 7

Solved

Path of least resistance

Find the length of the shortest path through the matrix from the top left to bottom right corner. You may move right, down, or d...

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

ongeveer 7 jaar ago

Solved

Summing digits

Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...

ongeveer 7 jaar ago

Solved

Most nonzero elements in row

Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

ongeveer 7 jaar ago

Solved

Create times-tables

At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

ongeveer 7 jaar ago

Solved

Finding Perfect Squares

Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

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

ongeveer 7 jaar ago

Solved

Make a checkerboard matrix

Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Example...

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

ongeveer 7 jaar ago