Determine given vector is even or odd
Find the numbers of the input vector is odd or even then replace even with 1 and odd with 0
Example
x = [ 3 3 4 6 1]
...
Diagonal & Anti-Diagonal Matrix: Easy
Create a matrix as shown below from "magic" square.
For example:
if input x=9;then use mgic(x) and create the matrix...
約7年 前
解決済み
The prisoner
"We want information, information, information."
"Who are you?"
Input can be a string or a number (array).
約7年 前
解決済み
Too Many Zeros, Dump Them!
Sometimes when I create a matrix, I use this syntax:
a = zeros(1000,1000);
But when the function ends, I find that I don'...
約7年 前
解決済み
CARDS PROBLEM
Read my mind and tell me the card number that I have now in my hands.
約7年 前
解決済み
Area of a Square
Given the length x of the side of a regular square, find the area of the square, A.
Change matrix to vector
Vector is a matrix whose size is 1 x n or n x 1.
Change matrix to vector.
x =
4 3
5 1
...
約7年 前
解決済み
Tridiagonal
Return an n-by-n matrix that has a, b, c as the subdiagonal, main diagonal, and superdiagonal entries in the matrix.
Example ...
約7年 前
解決済み
Largest territory
Determine whose territory is largest. If there are multiple numbers tied for the largest territory, return the smallest number. ...
約7年 前
解決済み
Replace pattern 0 1 0 and 1 0 1
Find and replace a pattern in a row of zeroes and ones.
* Find 1 0 1 and replace it with 1 1 1
* Find 0 1 0 and replace it w...
Can we make a triangle?
Given three positive number, check whether a triangle can be made with these sides length or not. remember that in a triangle su...
Height of a right-angled triangle
Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...