Solved


Negation the hard way
Write a function that has the following property: f(f(x)) = -x for any numeric array x. Note that there is no restriction on ...

5 years ago

Solved


Beat the test suite if you can :)
Solve this problem based on clues in the test suite.

5 years ago

Solved


Pandigital number n°1 (Inspired by Project Euler 32)
A little warm-up to begin... An n-digit number is pandigital if it makes use of all the digits 1 to n exactly ONCE. For ex...

5 years ago

Solved


Create a code for XNOR
Given two inputs, output XNOR of those two

5 years ago

Solved


Calculate the base-10 logarithm of a number
Calculate the logarithm of number x

5 years ago

Solved


Leap Year
According to Gregorian Calender(which is in use now, in many countries),decide whether a given year is a leap year or not. Give...

5 years ago

Solved


root?
* Given a function 'foo', and a position 'there', find the root near 'there'. * For example: If foo=@sin, and there=3.1, then r...

5 years ago

Solved


Gamma Function
Evaluate the <http://en.wikipedia.org/wiki/Gamma_function/ Gamma Function>. Gamma_val(0) = Inf Gamma_val(1.2) = 0.9182

5 years ago

Solved


N-Cards Problem
You have a deck of _N_ cards numbered in order from 1 to _N_. You discard the top card (card 1) and place the next card (card 2)...

5 years ago

Solved


Penny flipping - calculate winning probability (easy)
Two players are playing a fair penny flipping game. For each flip, the winner adds one penny from the loser's collection to his/...

5 years ago

Solved


Back to basics 16 - byte order
Covering some basic topics I haven't seen elsewhere on Cody. Switch the byte order of the input (i.e. if little-endian -> big...

5 years ago

Solved


poll: would you like the regexp (?@cmd) functionality to be banned in Cody?
This problem is a poll (and a little bit of "white hat hacktivism" as well) regarding Cody users sentiment about the use of rege...

5 years ago

Solved


Do Fast Fourier Transformation
Example Fast Fourier Transformation from vector [2,1]) ans = 3 1

5 years ago

Solved


Sophie Germain prime
In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

5 years ago

Solved


Indexed Probability Table
This question was inspired by a Stack Overflow question forwarded to me by Matt Simoneau. Given a vector x, make an indexed pro...

5 years ago

Answered
Question about Indexing a function
B = A(A<0) means to allocate all the elements of A which are less than zero to B. In case you want to use if statement to obtai...

5 years ago | 2

| accepted

Answered
Why do I get "Array indices must be positive integers or logical values" error
Because you are defining an array using negetive indexes. > h3=u(t)-u(t-5); %u is undefined in your code As you have defined ...

5 years ago | 2

Question


Smallest positive number in MATLAB
I recently stumbled upon a question on Cody (#1874), which asked the user to input the smallest in MATLAB. As per my knowledge,...

5 years ago | 1 answer | 0

1

answer

Solved


Split array into pieces according to corresponding array
An array x of length n has values 1...m with each value appearing at least once. The values are sorted (n>=m). A second...

5 years ago

Solved


Neither minima nor maxima
Input v is a vector. Return all the elements of v which are not a local minimum or maximum. Example: v = [1 2 3 4 5] Ou...

5 years ago

Solved


Electrical Diode Current Calculation
In engineering, there is not always a single equation that describes a phenomenon accurately enough to be applied in all instanc...

5 years ago

Solved


newRMS
find root mean square of a signal x in less time than the test code and accurate to six places.

5 years ago

Solved


The cake is a lie...
You're hosting a birthday party with a large number of screaming children. Fortunately, you have a gigantic sheet cake in front...

5 years ago

Solved


Construct an index vector from two input vectors in vectorized fashion
Create an index vector defined by two input vectors, one defining the beginnings of one or more index ranges, and the other defi...

5 years ago

Solved


Finding peaks
Find the peak values in the signal. The peak value is defined as the local maxima. For example, x= [1 12 3 2 7 0 3 1 19 7]; ...

5 years ago

Solved


Indirect Sorting
Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column. Exa...

5 years ago

Solved


Who have the chance?
Obtain a free 10 score in cody, if you have a chance don't change anything if you want to try or do what you can do to gain for ...

5 years ago

Solved


Tell your secret
A secret can be told only to 2 persons in 5 minutes. Now, these 2 more persons can spread the secret to 4 other people in the ne...

5 years ago

Solved


Wait a second!
Your code needs to take 'exactly' one second to run — accurate to ±0.5 milliseconds. The input will be the number of millis...

5 years ago

Solved


Tricky timing
Write a function that takes between 0.5 seconds and 0.6 seconds to run.

5 years ago

Load more