Gelöst


Sum of diagonals elements of a matrix
Given a matrix, return the sum of all the elements across the diagonals. E.g. A = [1 2 3; 4 5 6; 7 8 9;...

etwa ein Monat vor

Gelöst


house of cards
How many cards do one need to build a house of cards with n stages? Short explanation: /\ 2 cards for 1 stage ...

etwa ein Monat vor

Gelöst


balance vector
Given a non-empty vector x with integer elements. x shall be called balance vector if one can split the elements of x into two g...

etwa ein Monat vor

Gelöst


Prime Product
My professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj su...

etwa ein Monat vor

Gelöst


Only once: cleaning up your columns
We have a logical array (with ones and zeroes). It is simple: after processing every column may only contain a single true value...

etwa ein Monat vor

Gelöst


Calculate the sum of first x natural numbers
Calculate the sum of first x natural numbers for example if n=10 output =1+2+..+10=55

etwa ein Monat vor

Gelöst


Aquiles y la tortuga
Contaba Zenón en su famosa paradoja que un día Aquiles, el guerrero griego más veloz de la Hélade, se enfrentó a una pequeña tor...

etwa ein Monat vor

Gelöst


Draw 'Y'
Draw 'Y' in an x-by-x matrix (where x is odd and x >= 3) Examples: x = 3 y = [1 0 1 0 1 0 0 1 0] x = 5 y = [1...

etwa ein Monat vor

Gelöst


Back to basics 7 - Equal NaNs
Covering some basic topics I haven't seen elsewhere on Cody. Given 2 input variables, output true if they are equal, false ot...

etwa ein Monat vor

Gelöst


Infernal Recursion
Consider the recursion relation: x_n = (x_(n-1)*x_(n-2))^k Given x_1, x_2, and k, x_n can be found by this definition. Wr...

etwa ein Monat vor

Gelöst


count any radix?
given radix r(2-9), digts d(1-4), give all possible strings in sorted order. for example, if r=2, d=2, then output {'00' '01' '1...

etwa ein Monat vor

Gelöst


Check if is a square
Given four coordinates, write a function to check if they form a square on the XY plane.

etwa ein Monat vor

Gelöst


Combined Ages 1 - Symmetric, n = 3
You have probably seen the common riddle wherein combined ages are provided and you must determine the individual ages. For exam...

etwa ein Monat vor

Gelöst


COUNT VOWEL 2
The objective of this problem is to determine the number of unique vowels used in the given string. Now count vowels in STRI...

etwa ein Monat vor

Gelöst


Red Cross ❌

etwa ein Monat vor

Gelöst


Cull vector elements that contain a specified digit
Given inputs of (1) a row vector and (2) a digit, identify the elements of that vector that contain the digit, remove them, and ...

etwa ein Monat vor

Gelöst


Accessing elements on the diagonal
Access the diagonal elements of a matrix without 'diag' function

etwa ein Monat vor

Gelöst


One-hot encoding

etwa ein Monat vor

Gelöst


Number of odd and even elements within matrix
Input(m) - any matrix with integers Output(n) - n(1)=number of odd elements, n(2)=number of even elements Example: * m=...

etwa ein Monat vor

Gelöst


Set defaults
Write a function that computes the volume of a cube. The function should be able to accept three inputs: the length, width, and...

etwa ein Monat vor

Gelöst


check whether a number is a pentatope number
<https://oeis.org/A000332>

etwa ein Monat vor

Gelöst


Compute the Dedekind psi function
Write a function to compute the Dedekind psi function. The values for n = 1, 2, 3, 4, 5, and 6 are 1, 3, 4, 6, 6, and 12.

etwa ein Monat vor

Gelöst


prime to each other
Given two integers n1, n2 greater than 1, find out if they have common divisors or are prime to each other. Return "true" if the...

etwa ein Monat vor

Gelöst


Juggler sequence revisited
This problem is related to <http://www.mathworks.com/matlabcentral/cody/problems/42835-return-the-sequence-element-ii Problem 42...

etwa ein Monat vor

Gelöst


attenuation
A beam of X-rays propagates a length d(1) through a medium with an attenuation coefficient alpha(1). After that the beam propaga...

etwa ein Monat vor

Gelöst


Integer to boolean
Write a general function that will create the following conversation; Input is a column vector with integers Output is a b...

etwa ein Monat vor

Gelöst


Five Fingers
A little girl has just learnt how to count from 1 to N using the five fingers of her left hand as follows. She starts by calling...

etwa ein Monat vor

Gelöst


"Identify and Replace Outliers in a Numeric Array"
Given a numeric array, identify outliers that are more than two standard deviations away from the mean and replace them with the...

etwa ein Monat vor

Gelöst


Simple date to serial no. conversion
Convert a date string to a serial date number. For example if you take x='19-May-2001' then the result is 730990 x...

etwa ein Monat vor

Gelöst


Detect a number and replace with two NaN's
Write code which replaces the number 1 with two NaNs. Example X = [ 1 2 NaN 4 1 3 7 NaN 1 4 NaN 2] ...

etwa ein Monat vor

Mehr laden