Mode
Find the mode of the vector
Assumption: no vector is bimodal
Example 1: input=[1 2 3 4 4]; output=4
Example 2: input=[7...
2年弱 前
解決済み
Average Grade
Given a 1x5 vector presents the grades of a student on five tests. Calculate the average grade of that student.
2年弱 前
解決済み
Palindrome Check
Check whether the entire matrix is palindrome or not.
Example
matrix = [7 8 7]
matrix_reverse = [7 8 7]
So the mat...
2年弱 前
解決済み
Reverse a matrix
Its simple. You have to reverse a given matrix.
2年弱 前
解決済み
multiple of nine?
Given a positive number n, return true if n is a multiple of 9 and false if not. Do not make the division and do not use functio...
2年弱 前
解決済み
Leap Year
According to Gregorian Calender(which is in use now, in many countries),decide whether a given year is a leap year or not.
Give...
2年弱 前
解決済み
Replace multiples of 5 with NaN
It is required to replace all values in a vector that are multiples of 5 with NaN.
Example:
input: x = [1 2 5 12 10 7]
...
2年弱 前
解決済み
Replicate elements in vectors
Replicate each element of a row vector (with NaN) a constant number of times.
Examples
n=2, A=[1 2 3] -> [1 1 2 2 3 3]
...
2年弱 前
解決済み
Rotate array 90 degrees
Rotate the given matrix by 90 degrees.
Example,
A = [1 2 3 ; 4 5 6 ] B = rotated(A) = [ 3 6; 2 5; 1 4 ]
Get all prime factors
List the prime factors for the input number, in decreasing order. List each factor. If the prime factor occurs twice, list it as...
Find the product of a Vector
How would you find the product of the vector [1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0] times 2?;
x = [1 : 0.5 : 6];
y ...