Risolto


Back to basics 12 - Input Arguments
Covering some basic topics I haven't seen elsewhere on Cody. Return a value equal to the number of input arguments to the fun...

circa 10 anni fa

Risolto


Array GCD
* Find Greatest Common Divisor in a given array * Function Template: function ans = arraygcd(a) % a=[45 15 200 ...

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


Vector LCM
* Find Least Common Multiple of a given vector. * Need general solution as the test suite will be expanded. * Function Templa...

circa 10 anni fa

Risolto


All your base are belong to us
Find the base _b_ logarithm of the input decimal number _x_. Express the output as a decimal number. The first argument is the n...

circa 10 anni fa

Risolto


Remove DC
Input x is the sampled signal vector, may have both AC and DC components. Output y should not contain any DC component. Examp...

circa 10 anni fa

Risolto


Who is the baby and who is the daddy in this family?
Given an array of numbers that shows the characteristcs of all family members, find who is the baby and who is daddy in this fam...

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


Counting Money
Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99. E...

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


All capital?
Are all the letters in the input string capital letters? Examples: 'MNOP' -> 1 'MN0P' -> 0

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


Summing Digits within Text
Given a string with text and digits, add all the numbers together. Examples: Input str = '4 and 20 blackbirds baked in a...

circa 10 anni fa

Risolto


Test for balanced parentheses
Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


Extract leading non-zero digit
<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

circa 10 anni fa

Risolto


Quote Doubler
Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote ...

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

circa 10 anni fa

Risolto


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

circa 10 anni fa

Risolto


Triangle sequence
A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

circa 10 anni fa

Risolto


Area of an equilateral triangle
Calculate the area of an equilateral triangle of side x. <<http://upload.wikimedia.org/wikipedia/commons/e/e0/Equilateral-tr...

circa 10 anni fa

Risolto


Find a Pythagorean triple
Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them com...

circa 10 anni fa

Risolto


Side of an equilateral triangle
If an equilateral triangle has area A, then what is the length of each of its sides, x? <<http://upload.wikimedia.org/wikipe...

circa 10 anni fa

Risolto


Side of a rhombus
If a rhombus has diagonals of length x and x+1, then what is the length of its side, y? <<http://upload.wikimedia.org/wikipe...

circa 10 anni fa

Risolto


Dimensions of a rectangle
The longer side of a rectangle is three times the length of the shorter side. If the length of the diagonal is x, find the width...

circa 10 anni fa

Carica altro