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

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

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

mer än 2 å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 2 år ago

Solved

Word Counting and Indexing
You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a maste...

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

mer än 2 år ago

Solved

Find common elements in matrix rows
Given a matrix, find all elements that exist in every row. For example, given A = 1 2 3 5 9 2 5 9 3 2 5 9 ...

mer än 2 år ago

Solved

Clean the List of Names
Given a list of names in a cell array, remove any duplications that result from different capitalizations of the same string. So...

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

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

mer än 2 år ago

Solved

Binary numbers
Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

mer än 2 år ago

Solved

Alphabetize by last name
Given a list of names in a cell array, sort the list by the last name. So if list = {'Barney Google','Snuffy Smith','Dagwood ...

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

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

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

mer än 2 år ago

Solved

Times 2 - START HERE
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

mer än 2 å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 2 år ago

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

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

mer än 2 år ago

Solved

Given a and b, return the sum a+b in c.

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

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

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

nästan 3 år ago

Solved

Indexed Probability Table
This question was inspired by a Stack Overflow question forwarded to me by Matt Simoneau. Given a vector x, make an indexed pro...

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

nästan 3 år ago

Solved

Given two strings, find the maximum overlap
Given two strings s1 and s2, create a new string s3 which is as short as possible and contains both strings. If s1 = [1 2...

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

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

nästan 3 år ago