Community Profile

Contact

Top 1% contributor

If I have a vector w (length n) and I want to pick a single random number between 1 and n using w as the weights, I can do somet...

1 Answers

0

Asked 3 months ago

<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

Solve this!

1 year ago

Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.

Given a collection of points, return the indices of the rows that contain the two points most distant from one another. The inpu...

Given a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x. Ties are resolved by a ...

Given a string with text and digits, add all the numbers together. Examples: Input str = '4 and 20 blackbirds baked in a...

Add all the integers from 1 to n in which the digit m does not appear. m will always be a single digit integer from 0 to 9. no...

Given the string s1, return the string s2 with the target characters removed. For example, given s1 = 'the main event' your ...

Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

Quadratic equations have the form: ax^2 + bx + c = 0. Example: x^2 + 3x + 2 = 0, where a = 1, b = 3, and c = 2. The equation has...

Omit columns averages from a matrix. For example: A = 16 2 3 13 5 11 10 8 9 7 ...

Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

Covering some basic topics I haven't seen elsewhere on Cody. Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...

Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive integer MATLAB can handle.

Given a vector x, the output y should equal the length of x.

Given a "counting sequence" vector x, construct the original sequence y. A counting sequence is formed by "counting" the entrie...

The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

Program an exclusive or operation *without* using the MATLAB function xor. Use logical operators like |, &, ~, ... instead. ...

Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

1:3 -> 0; 3:5 -> 6

Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 ...

Given a string s representing a list of numbers, find the five consecutive numbers that multiply to form the largest number. Spe...

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

Given a vector x, find the "counting sequence" y. A counting sequence is formed by "counting" the entries in a given sequence...

Given a lowercase letter or a digit as input, return the row where that letter appears on a <http://en.wikipedia.org/wiki/Keyboa...

Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

Given a matrix, m-by-n, find all the rows that have the same "increase, decrease, or stay same" pattern going across the columns...

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

Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...

Are all the letters in the input string capital letters? Examples: 'MNOP' -> 1 'MN0P' -> 0

Load more

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list:

See all countries