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...
9ヶ月 前
解決済み
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...
9ヶ月 前
解決済み
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...
Pi Digit Probability
Assume that the next digit of pi constant is determined by the historical digit distribution. What is the probability of next di...
9ヶ月 前
解決済み
Triangle sequence
A sequence of triangles is constructed in the following way:
1) the first triangle is Pythagoras' 3-4-5 triangle
2) the second...
9ヶ月 前
解決済み
Birthday cake
It's Cody's 5th birthday, and you've been tasked with putting the candles on the cake. Your goal is to maximize the distance bet...
9ヶ月 前
解決済み
Sum of Even Fibonacci Numbers
Description:
The Fibonacci sequence is defined as follows:F(1)=1,F(2)=1,F(n)=F(n−1)+F(n−2) for n>2
Write a function that compu...
Battery Charge Efficiency Calculation
In a Battery Management System (BMS), the efficiency of battery charging can be estimated using the formula:
where:
is the...