Solved

Finding perimeter of a rectangle

A rectangle has a length of x centimeters and a width of w centimeters. Find the perimeter.

4 years ago

Solved

Find the hypotenuse

Given a and b (the two sides of a right-triangle), find c, the hypotenuse.

4 years ago

Solved

Renaming a field in a structure array

MATLAB has a <http://www.mathworks.com/help/techdoc/ref/setfield.html setfield> and a <http://www.mathworks.com/help/techdoc/ref...

4 years ago

Solved

Return 'on' or 'off'

When the input is true, return 'on', otherwise, return 'off'.

4 years ago

Solved

Sum of odd numbers in a matrix

Find the sum of all the odd numbers in a matrix. Example x = [2 3 5 7 1 4 11] y = 27

4 years ago

Solved

Factorize THIS, buddy

List the prime factors for the input number, in decreasing order. List each factor only once, even if the factorization includes...

4 years ago

Solved

sum of non-primes

The sum of the non-primes below 10 is 1+4+6+8+9+10=38 Find the sum of all the non-primes below the input, N.

4 years 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 =...

4 years ago

Solved

Number of Circles in a Number

Given a number, return the number of closed 'circles' in the base 10 numerical representation. Note: the number 4 has no circ...

4 years ago

Solved

How many jokers?

* Given DNA codes of a group of suspects, * and a code for certain types of jokers, * Count how many jokers of that type. * ...

4 years ago

Solved

Add two numbers

Calculate the sum of two numbers. Example input = [2 3] output = 5

4 years ago

Solved

Distance walked 2D

Suppose you go from x-y coordinates [3,4] to [0,0] to [0,1] to [1,1], then you walked 7 units of distance.

4 years ago

Solved

Deleting an element in a matrix

For vector Grades=[98 56 78 34 100 88 87], delete the number 78 to get the following matrix Grades=[98 56 34 100 88 87] **re...

4 years ago

Solved

Convert Fahrenheit to Celsius

Calculate the Celsius temperature C given the Fahrenheit temperature F. Examples: Input F = 90 Output C is 32.22 I...

4 years ago

Solved

Who has power to do everything in this world?

There is only one person who is older than this universe. He is Indian version of Chuck Norris.

4 years ago

Solved

Maximum value in a matrix

Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

4 years ago

Solved

Who invented zero?

We know the importance zero in computer science, mathematics... but who invented zero? Clue: He was the first in the line ...

4 years ago

Solved

Which doors are open?

There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

4 years ago

Solved

Making change

Given an amount of currency, return a vector of this form: [100 50 20 10 5 2 1 0.5 0.25 0.1 0.05 0.01] Example: Input a = ...

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

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

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

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

4 years ago

Solved

Sum the elements in either diagonal of a square matrix

Sum the elements of a square matrix that lie on either the major diagonal or anti-diagonal.

4 years ago