There are 10 types of people in the world
Those who know binary, and those who don't.
The number 2015 is a palindrome in binary (11111011111 to be exact) Given a year...
Binary code (array)
Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector).
Example:
Inpu...
5年弱 前
解決済み
Relative ratio of "1" in binary number
Input(n) is positive integer number
Output(r) is (number of "1" in binary input) / (number of bits).
Example:
* n=0; r=...
Natural numbers in string form
Create a cell array of strings containing the first n natural numbers. _Slightly_ harder than it seems like it should be.
Ex...
5年弱 前
解決済み
Right and wrong
Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...
Television Screen Dimensions
Given a width to height ratio of a TV screen given as _w_ and _h_ as well as the diagonal length of the television _l_, return t...
5年弱 前
解決済み
Convert a Cell Array into an Array
Given a square cell array:
x = {'01', '56'; '234', '789'};
return a single character array:
y = '0123456789'
5年弱 前
解決済み
Cell joiner
You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...
5年弱 前
解決済み
Better bullseye matrix
<http://www.mathworks.com/matlabcentral/cody/problems/18-bullseye-matrix Problem 18> asks to create a bullseye matrix like this:...
Spiral In
Create an m by n matrix filled with sequential integers starting from 1 and arranged in a counterclockwise spiral that hugs the ...
5年弱 前
解決済み
"mirror" matrix
Create n x 2n "mirror" matrix of this type:
Examples
For n = 2
m = [ 1 2 2 1
1 2 2 1 ]
For n = 3
m = ...
5年弱 前
解決済み
Make a Star Pyramid
Create a star pyramid. First line will have 1 star, second will have two stars and so on... a basic program which is easily done...
5年弱 前
解決済み
Special matrix
Make a square matrix with this shape. For n=4
M =
1 1 0 0
1 0 1 0
0 1 0 ...
5年弱 前
解決済み
Pascal's Matrix
Given an integer n ≥ 0, generate the ( _n_+1) × ( _n_+1) lower triangular <http://en.wikipedia.org/wiki/Pascal_matrix P...
5年弱 前
解決済み
Find the two-word state names
Given a list of states, remove all the states that have two-word names.
If
s1 = 'Alabama Montana North Carolina Vermont N...