Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...
2ヶ月 前
解決済み
Duplicates
Write a function that accepts a cell array of strings and returns another cell array of strings *with only the duplicates* retai...
Reverse Run-Length Encoder
Given a "counting sequence" vector x, construct the original sequence y.
A counting sequence is formed by "counting" the entrie...
2ヶ月 前
解決済み
Remove all the words that end with "ain"
Given the string s1, return the string s2 with the target characters removed.
For example, given
s1 = 'the main event'
your ...
2ヶ月 前
解決済み
Quote Doubler
Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote ...
2ヶ月 前
解決済み
Counting Money
Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99.
E...
Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because
6 = 1 + 2 + 3
which can be displayed ...
2ヶ月 前
解決済み
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...
2ヶ月 前
解決済み
Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...
2ヶ月 前
解決済み
Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the numbers. Otherwise return false.
Example...
2ヶ月 前
解決済み
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...
Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so:
x = [1 2 3 4]
Commas are optional, s...