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".
4年弱 前
解決済み
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 ...
4年弱 前
解決済み
Alternating sum
Given vector x, calculate the alternating sum
y = x(1) - x(2) + x(3) - x(4) + ...
4年弱 前
解決済み
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...
Sorted highest to lowest?
Return 1 if the input is sorted from highest to lowest, 0 if not.
Example:
1:7 -> 0
[7 5 2] -> 1
4年弱 前
解決済み
Distance walked 2D
Suppose you go from x-y coordinates [3,4] to [0,0] to [0,1] to [1,1], then you walked 7 units of distance.
4年弱 前
解決済み
Create a square matrix of multiples
Given an input, N, output a matrix N x N with each row containing multiples of the first element of each row.
This also applies...
4年弱 前
解決済み
Geometric series
Find the sum, given the first term t1, the common ratio r, and number of terms n.
Examples
If input t1=1, r=1, n=7 the...
Roots
Find out the roots of a given polynomial equation.Given are the coefficients of the equation.
4年弱 前
解決済み
Wind Chill Computation
On a windy day, a temperature of 15 degrees may feel colder, perhaps 7 degrees. The formula below calculates the "wind chill," i...
4年弱 前
解決済み
Reverse a matrix
Its simple. You have to reverse a given matrix.
4年弱 前
解決済み
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...
4年弱 前
解決済み
The Goldbach Conjecture
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...
4年弱 前
解決済み
Rotate a Matrix
Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise
4年弱 前
解決済み
Remove the vowels
Remove all the vowels in the given phrase.
Example:
Input s1 = 'Jack and Jill went up the hill'
Output s2 is 'Jck nd Jll wn...
4年弱 前
解決済み
Create an index-powered vector
Given a input vector x, return y as index-powered vector as shown below.
Example
x = [2 3 6 9]
then y should be
[...