A résolu


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

plus de 12 ans il y a

A résolu


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

plus de 12 ans il y a

A résolu


middleAsColumn: Return all but first and last element as a column vector
Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

plus de 12 ans il y a

A résolu


Implement a counter
Write a function that returns a function that counts the number of times it is invoked. Example: >> h = counter; >> h() ...

plus de 12 ans il y a

A résolu


Function composition - harder
Write a function that accepts an arbitrary number of function handles f_1, f_2, ..., f_n and returns the composition h. That is,...

plus de 12 ans il y a

A résolu


Function composition
Write a function that accepts two function handles f and g and returns the composition h. That is, h = (f o g)(x) = f(g(x)) ...

plus de 12 ans il y a

A résolu


Return elements unique to either input
Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

plus de 12 ans il y a

A résolu


drowsy?
This dog() may be drowsy or function immediately when you call, return 1 or 0 accordingly within 2/10 second.

plus de 12 ans il y a

A résolu


Convert hex color specification to MATLAB RGB
Here's something that comes up all the time if you deal with web pages. Given a <http://www.w3schools.com/html/html_colors.as...

plus de 12 ans il y a

A résolu


Data decompression
A chunk of data is to be 'decompressed'. Input: * compressed: a row vector of uint8 values. This is the compressed data. ...

plus de 12 ans il y a

A résolu


Toolbox check part 3
In my ongoing quest to highlight obscure parts of MATLAB, the latest challenge is to take 2 string inputs, one a MATLAB toolbox ...

plus de 12 ans il y a

A résolu


convert?
* Given a string containing a number followed by pounds or kgs, for example: * 'Billy lost 22 pounds in four weeks.' * 'Maria ...

plus de 12 ans il y a

A résolu


Closely related?
Given a function past_records() that will report blood sugar level of two twin brothers some random number of days ago. For exam...

plus de 12 ans il y a

A résolu


Bang Bang in Bangalore
Imagine a strange language disorder, Bangolangosis, has developed among trigonometricians of <http://en.wikipedia.org/wiki/Banga...

plus de 12 ans il y a

A résolu


Use of regexp
* Given a string, containing several sentences, such as: * 'I played piano. John played football. Anita went home. Are you safe...

plus de 12 ans il y a

A résolu


Back to basics 24 - Symbolic variables
Covering some basic topics I haven't seen elsewhere on Cody. Given a string algebraic expression, return the symbolic variabl...

plus de 12 ans il y a

A résolu


Vectorizing, too easy or too hard?
Please insert a . before any ^, * or / in the string. That's it!!

plus de 12 ans il y a

A résolu


Fun Race
* Given two unary functions foo and goo. * Check whether foo(0) runs faster than goo(0). * Output 1 if foo is faster, otherwis...

plus de 12 ans il y a

A résolu


Return unique values without sorting
If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

plus de 12 ans il y a

A résolu


Create a square matrix of multiples
Given an input, N, output a matrix N x N with each row containing multiples of the first element of each row. This also applies...

plus de 12 ans il y a

A résolu


Create One Large Eye of size N x N Quickly?
*<http://en.wikipedia.org/wiki/Aye_(yes) Aye !!!>*

plus de 12 ans il y a

A résolu


Cell Array Inception?
Jimmy is a beginning MATLAB student who is trying to read in a text file and build a cell array of strings, where A{k} is the kt...

plus de 12 ans il y a

A résolu


Nonuniform quantizer as a piecewise constant function
Implement a nonuniform quantizer as the following piecewise function: y = -3.5, x < 3 y = -1.5, -3 &#8804; x < -1 y = -...

plus de 12 ans il y a

A résolu


Sum of first n terms of a harmonic progression
Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....

plus de 12 ans il y a

A résolu


Transposition as a CIPHER
This all about transcripting a text message. If the input string is: *s1 = 'My name is Sourav Mondal'*, then the output is: *s2...

plus de 12 ans il y a

A résolu


Word Counting and Indexing
You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a maste...

plus de 12 ans il y a

A résolu


Nearest
*Description* Find the value and index of the element in vector _x_ that is nearest to value _y_. _y_ should be able to be a ...

plus de 12 ans il y a

A résolu


First N Perfect Squares
*Description* Return the first N perfect squares *Example* input = 4; output = [ 1 4 9 16 ];

plus de 12 ans il y a

A résolu


Wind outward from the center ...
Create an n-by-n matrix with elements ranging from 1 to n^2 in a rectangular spiral pattern. Example if n = 5 : 21 ...

plus de 12 ans il y a

A résolu


Back to basics 25 - Valid variable names
Covering some basic topics I haven't seen elsewhere on Cody. Given a string, return true if it is a valid MATLAB variable nam...

plus de 12 ans il y a

Charger plus