Solved

Make a run-length companion vector

Given a vector x, return a vector r that indicates the run length of any value in x. Each element in r shows how many times the ...

1 year ago

Solved

Rounding off numbers to n decimals

Inspired by a mistake in one of the problems I created, I created this problem where you have to round off a floating point numb...

1 year ago

Solved

Generate N equally spaced intervals between -L and L

Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

1 year ago

Solved

Matlab Basics - Rounding III

Write a script to round a large number to the nearest 10,000 e.g. x = 12,358,466,243 --> y = 12,358,470,000

1 year ago

Solved

Spot the outlier

All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

1 year ago

Solved

Love triangles

Given a vector of lengths [a b c], determines whether a triangle with non-zero area (in two-dimensional Euclidean space, smarty!...

1 year ago

Solved

Check that number is whole number

Check that number is whole number Say x=15, then answer is 1. x=15.2 , then answer is 0. <http://en.wikipedia.org/wiki/Whole...

1 year ago

Solved

First non-zero element in each column

For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

1 year ago

Solved

Calculate the Levenshtein distance between two strings

This problem description is lifted from <http://en.wikipedia.org/wiki/Levenshtein_distance>. The Levenshtein distance betwee...

1 year ago

Solved

Knight's Tour Checker

Given a matrix a, determine whether or not a legal <http://en.wikipedia.org/wiki/Knight's_tour knight's tour> is present. The kn...

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

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

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

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

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

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

1 year ago

Solved

Find the largest number

Find the largest number |x| among 4 numbers given as variables |a|, |b|, |c|, and |d|. Example: Input: a = 4; b = 7; c ...

1 year ago

Solved

Find the biggest empty box

You are given a matrix that contains only ones and zeros. Think of the ones as columns in an otherwise empty floor plan. You wan...

1 year ago

Solved

Sum of Two Numbers

Given two integer numbers x and y, calculate their sum and put it in z. Examples: Inputs x = 2, y = 4 Output z is 6 ...

1 year ago

Solved

Wind Chill Computation

On a windy day, a temperature of 15 degrees may feel colder, perhaps 7 degrees. The formula below calculates the "wind chill," i...

1 year ago

Solved

Sum of adjacent elements in a vector

Given a vector v, return a vector s containting the sum of every two adjacent elements in the vector. Every element s(i) cont...

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

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

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

1 year ago

Solved

We love vectorized solutions. Problem 1 : remove the row average.

Given a 2-d matrix, remove the row average from each row. Your solution MUST be vectorized. The solution will be tested for ac...

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

1 year ago

Solved

Convert a vector into a number

This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

1 year ago

Solved

Area of a triangle

A triangle is given with base *'b'* ,vertical hight *'h'* . then find it's area.

1 year ago

Solved

How many Integers?

Count the integers in a given vector |v|. You *must* use a loop to count each element separately. Examples: Input: v...

1 year ago