Community Profile

Contact

Top 1% contributor

27 downloads

3 years ago

Tell me the slope, given a vector with horizontal run first and vertical rise next. Example input: x = [10 2];

Solve this!

4 months ago

Write a function named LightningDistance that outputs "distance" given input "seconds". Seconds is the time from seeing lightnin...

7 months ago

Given a Fahrenheit value F, convert to a Celsius value C. While the equation is C = 5/9 * (F - 32), as an exercise use two state...

Pizza prices are typically listed by diameter, rather than the more relevant feature of area. Compute a pizza's value (cost per ...

Create a row array from 9 to 1, using the double colon operator.

11 months ago

Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

1 year ago

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

If you have two small strings, like 'a' and 'b', return them put together like 'ab'. 'a' and 'b' => 'ab' For extra ...

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

Given a circle's radius, compute the circle's area. Use the built-in mathematical constant pi.

Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

inner product of two vectors

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

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

2 years ago

Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...

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

Replace NaNs with the number that appears to its left in the row. If there are more than one consecutive NaNs, they should all ...

Given an input number representing the number of bottles of beer on the wall, output how many are left if you take one down and ...

This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

you just measured its surface area, that is the input.

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

Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive integer MATLAB can handle.

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

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

The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

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

Load more