Solved

Draw 'H'

Draw a x-by-x matrix 'H' using 1 and 0. (x is odd and bigger than 2) Example: x=5 ans= [1 0 0 0 1 1 0 0 0 1 ...

6 månader ago

Solved

Draw 'C'.

Given x as input, generate a x-by-x matrix 'C' using 0 and 1. example: x=4 ans= [0 1 1 1 1 0 0 0 ...

6 månader ago

Solved

Draw 'F'

Draw a x-by-x matrix 'F' using 1 and 0. (x is odd and bigger than 4) Example: x=5 ans= [1 1 1 1 1 1 0 0 0 0 ...

6 månader ago

Solved

Draw 'J'

Given n as input, generate a n-by-n matrix 'J' using 0 and 1 . Example: n=5 ans= [0 0 0 0 1 0 0 0 0 1 0 0 ...

6 månader ago

Solved

Simple polynomial evaluation

Compute the value of a polynomial of degree n with all coefficients '1', at value x. n is always n>=0. p(x)=1+x+x^2+...+x^n...

6 månader ago

Solved

Draw a 'N'!

Given n as input, generate a n-by-n matrix 'N' using 0 and 1 . Example: n=5 ans= [1 0 0 0 1 1 1 0 0 1 1 0 ...

6 månader ago

Solved

Too mean-spirited

Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

6 månader ago

Solved

7 segment LED display

Given a whole number, output how many segments would be lit up to display it on a 7 segment LED display (see Wikipedia: <http://...

6 månader ago

Solved

Pattern Sum

Write a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: k...

6 månader ago

Solved

Convert from Base 10 to base 5

Convert the input number from base 10 into base 5: for example: if a(in base 10)= 5 then a(in base 5)= 10

6 månader ago

Solved

Given a matrix, swap the 2nd & 3rd columns

If a = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]; then the result is ans = 1 3 2 4 1 3 2...

6 månader ago

Solved

matrix zigzag

Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix [ 1 2 3 ; 4 5 6 ; 7 8 9 ] the resulting 1-...

6 månader 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...

6 månader 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...

6 månader ago

Solved

Find state names that end with the letter A

Given a list of US states, remove all the states that end with the letter A. Example: Input s1 = 'Alabama Montana Nebras...

6 månader ago

Solved

Find the two-word state names

Given a list of states, remove all the states that have two-word names. If s1 = 'Alabama Montana North Carolina Vermont N...

6 månader ago

Solved

Find state names that start with the letter N

Given a list of US states, remove all the states that start with the letter N. If s1 = 'Alabama Montana Nebraska Vermont Ne...

6 månader ago

Solved

Triangle Numbers (★★)

(copy of problem 5) Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3...

6 månader 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, ...

6 månader 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. ...

6 månader ago

Solved

Remove the polynomials that have positive real elements of their roots.

The characteristic equation for a dynamic system is a polynomial whose roots indicate its behavior. If any of the <http://www.ma...

6 månader ago

Solved

DNA N-Gram Distribution

Given a string s and a number n, find the most frequently occurring n-gram in the string, where the n-grams can begin at any poi...

6 månader 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...

6 månader ago

Solved

Find the palindrome

Given the string a, find the longest palindromic sub-string b. So when a = 'xkayakyy'; you should return b = 'kayak';

6 månader 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...

6 månader 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...

6 månader 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...

6 månader 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...

6 månader 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 ...

6 månader 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 =...

6 månader ago