Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4
So if n = 3, then return
[1 2 2 3 3 3]
And if n = 5, then return
[1 2 2 3 3 3 4...
거의 2년 전
문제를 풀었습니다
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...
거의 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...
Counting Sequence
Given a vector x, find the "counting sequence" y.
A counting sequence is formed by "counting" the entries in a given sequence...
거의 2년 전
문제를 풀었습니다
Possible Outcomes of American Roulette
The payout for American roulette can be calculated by:
payout = (38/n)-1
where n is the number of squares the bet covers.
...
거의 2년 전
문제를 풀었습니다
NCHOOSEK - Time Optimization
*Input*
* *V* —— Set of all choices, a vector of N, 1 < N < 100
* *K* —— Number of selected choices, a scalar, 0 <= K <=...
거의 2년 전
문제를 풀었습니다
Combinations without using nchoosek
You have to generate a matrix with all possible combinations of n elements *taken 2* at a time, *without using nchoosek(1:n,2)* ...
An Ohm's Law Calculator
*BACKGROUND / MOTIVATION:*
Many important observations in math and science can be described by short, but powerful, equations...