Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers.
Examples:
[index1 index2] = nearestNumbers([2 5 3...
14年弱 前
解決済み
The Goldbach Conjecture
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...
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...
14年弱 前
解決済み
Is the Point in a Triangle?
Check whether a point or multiple points is/are in a triangle with three corners
Points = [x, y];
Triangle = [x1, y1; x...
14年弱 前
解決済み
Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal.
Example:
>> M=magic(5);
>> flipDiagonal(M)
9 24 1 ...
14年弱 前
質問
bug in sortrows?
[SCd Merging]
*part 2:*
I found a smaller problem where things go wrong. Taking as input n=3 and x = =[0:0.3:1]' the output ...
14年弱 前 | 2 件の回答 | 0
2
回答
解決済み
Fibonacci sequence
Calculate the nth Fibonacci number.
Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ...
Examples:
Inpu...
14年弱 前
解決済み
Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1.
Example...
14年弱 前
解決済み
Binary numbers
Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...
Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B.
So if
A = [1 2 3; 4 5 6];
and ...
14年弱 前
解決済み
Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...
14年弱 前
解決済み
Summing digits
Given n, find the sum of the digits that make up 2^n.
Example:
Input n = 7
Output b = 11
since 2^7 = 128, and 1 + ...