解決済み


Filter values in a vector
Cody often benefits from a functional style of programming. For example, your score is often better when you compose multiple fu...

1年以上 前

解決済み


Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

1年以上 前

解決済み


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.

1年以上 前

解決済み


Stacking vectors into a matrix
Given a 4x1 vector a, and a 2x2 matrix b, create a matrix M in which the first 2 rows are each identical to a and the last two r...

1年以上 前

解決済み


Matrix indexing with two vectors of indices (★★)
(copy of Prob 589) Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)). Thus, if...

1年以上 前

解決済み


Reindex a vector (★★)
(copy of Prob. 676) You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX h...

1年以上 前

解決済み


Average of corner elements of a matrix (★★)
(copy of prob 2235) Calculate the average of corner elements of a matrix. e.g. x=[1 2 3; 4 5 6; 7 8 9;] avg = (1+3+7+9)...

1年以上 前

解決済み


Generate a vector which contains a pyramid pattern (★★★★)
Generate a vector that contains terms that follows a pyramid pattern up to the nth row: 1 2 2 3 3 3 4 4 4 4 ...

1年以上 前

解決済み


Create times-tables (★★★)
(copy of prob 33) At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 ti...

1年以上 前

解決済み


Swap the first and last columns (★★)
(copy of Prob 19) Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becom...

1年以上 前

解決済み


Column Removal (★★★)
(copy of prob 7) Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2...

1年以上 前

解決済み


Select every other element of a vector (★★)
(copy of prob 6) Write a function which returns every other element of the vector passed in. That is, it returns the all odd-...

1年以上 前

解決済み


Make a checkerboard matrix (★★★★★)
(copy of Prob. 4) Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1...

1年以上 前

解決済み


Sum of elements of a vector (★★★)
Given any vector x = [x1, x2, x3, ... xn], compute the sum of its elements. Thus, if x = [ 1 3 -2 5 ], then the sum of its el...

1年以上 前

解決済み


Extract leading non-zero digit (★★★★★)
(Copy of Problem 47) Benford's Law states that the distribution of leading digits is not random. This is probably because man...

1年以上 前

解決済み


Fill a zeros matrix (★★★★★)
(Copy of Problem 830) The aim is to fill an array of all zeros given a numerical value and the index of row and columns for t...

1年以上 前

解決済み


About jokes (and compression)
An argument can be made about jokes. The shorter they are, the funnier. Further explained here: https://en.wikipedia.org/wiki/Hu...

1年以上 前

解決済み


Median computation (★★★)
See easy edition of this problem. However, now you must compute the median of any real-valued vector without using the in-built...

1年以上 前

解決済み


Mo money, mo math #2! (★★★)
(adapted from Prob 9 Cody team) You have a matrix for which each row is a person and the columns represent the number of quar...

1年以上 前

解決済み


Sum of terms in a series 1 (★★★)
Given x and n, compute the following sum: |x|+|x|^(1/2)+|x|^(1/3)+|x|^(1/4)+|x|^(1/5) ... + |x|^(1/n) where ||x|| indica...

1年以上 前

解決済み


Mo money, mo math 1! (★★★)
(adapted from Prob 9 Cody team) You have a vector where the elements represent the number of $20 bills, $10 bills, $5 bills, ...

1年以上 前

解決済み


Vector raised to a power, element-wise (★)
Given a vector A and a number x, raise each element of the vector to the power of x. Thus, if A = [2 5 7 1] and x = 0.5, then ...

1年以上 前

解決済み


Create a vector with n repeated values of a number x (★★)
If x=3 and n=7 then the vector y would be y=[3 3 3 3 3 3 3]

1年以上 前

解決済み


Generate n equally spaced "intervals" between -x and x (★)
Given n and x, return a list of numbers (in ascending order) that divides the interval [-x x] into n equal-length intervals. ...

1年以上 前

解決済み


PEMDAS test (★★)
Create the function that will return the following expression for x and y. <<https://i.ibb.co/RHWyzrv/Code-Cogs-Eqn-1.gif>> ...

1年以上 前

解決済み


Create a vector of n alternating ones and zeros (★★)
Given n, your output should be a vector y of numbers such that the first number is 1 and the numbers following it alternate betw...

1年以上 前

解決済み


Create a vector of the first n natural numbers (★)
If n = 7, your program should return a vector y, where y = [1 2 3 4 5 6 7].

1年以上 前

解決済み


Number of Flip Flop required in ripple counter
Find the number of flip flop required in ripple counter. If modulus of counter (N) is given find outnumber of Flip Flop (n) r...

1年以上 前

解決済み


Check transmitted data follow even parity (True or false)
Check transmitted data follow even parity (True or false) <http://en.wikipedia.org/wiki/Parity_bit/ Parity Bit> Say, '010...

1年以上 前

さらに読み込む