Christian Troiani
Followers: 0 Following: 0
統計
All
Feeds
解決済み
Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...
約7年 前
解決済み
The Goldbach Conjecture
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...
約7年 前
解決済み
Return the Fibonacci Sequence
Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...
約7年 前
解決済み
Project Euler: Problem 2, Sum of even Fibonacci
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te...
約7年 前
解決済み
Alternating sum
Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...
約7年 前
解決済み
Project Euler: Problem 6, Natural numbers, squares and sums.
The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...
約7年 前
解決済み
Bottles of beer
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 ...
約7年 前
解決済み
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...
約7年 前
解決済み
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...
約7年 前
回答済み
Is there a way to obtain desired index without using 'find'?
for k = 1:length(ar) if ar(k)==243 % Using your example of the 243 element posX=k; break ...
Is there a way to obtain desired index without using 'find'?
for k = 1:length(ar) if ar(k)==243 % Using your example of the 243 element posX=k; break ...
約7年 前 | 0
解決済み
How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...
約7年 前
解決済み
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...
約7年 前
解決済み
Which values occur exactly three times?
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...
約7年 前
解決済み
Pascal's Triangle
Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...
約7年 前
解決済み
Length of a short side
Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...
約7年 前
解決済み
Is this triangle right-angled?
Given any three positive numbers a, b, c, return true if the triangle with sides a, b and c is right-angled. Otherwise, return f...
約7年 前
解決済み
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...
約7年 前
解決済み
Is this triangle right-angled?
Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...
約7年 前
解決済み
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...
約7年 前
解決済み
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...
約7年 前
解決済み
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...
約7年 前
解決済み
Length of the hypotenuse
Given short sides of lengths a and b, calculate the length c of the hypotenuse of the right-angled triangle. <<http://upload....
約7年 前
解決済み
Area of an Isoceles Triangle
An isosceles triangle has equal sides of length x and a base of length y. Find the area, A, of the triangle. <<http://upload...
約7年 前
解決済み
Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...
約7年 前
解決済み
The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".
約7年 前
解決済み
Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]
約7年 前
解決済み
Simple equation: Annual salary
Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...
約7年 前
解決済み
Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...
約7年 前
解決済み
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...
約7年 前