Resuelto


return row and column indices given 2 values which define a range
Inspired by problem <http://www.mathworks.co.kr/matlabcentral/cody/problems/856-getting-the-indices-from-a-matrice> Inputs: - ...

más de 2 años hace

Resuelto


Splitting Square - Problem the third

más de 2 años hace

Resuelto


Pancake sorting - minimum flips.
Sort a stack of pancakes by flipping them using spatula. There are N pancakes with diameters 1:N. Spatula can be inserted anyw...

más de 2 años hace

Resuelto


Pancake sorting
Sort a stack of pancakes by flipping them using spatula. * There are _N_ pancakes with diameters _1:N_. * Spatula can be ins...

más de 2 años hace

Resuelto


Find the same and successive values in a vector
Find the same and successive values in a vector. For example: Input x = [ 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 ] Start and end...

más de 2 años hace

Resuelto


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...

más de 2 años hace

Resuelto


Find indices of diagonal elements
Given a matrix A and a diagonal index d (where 0 indicates the main diagonal and off-diagonals are identified by positive and n...

más de 2 años hace

Resuelto


Find the distance between runs
Another question inspired by the <http://uk.mathworks.com/matlabcentral/answers/?s_tid=gn_mlc_an answers forum>: A vector of ...

más de 2 años hace

Resuelto


Find Elements in Range
Based on a question on <http://www.mathworks.com/matlabcentral/answers/ MATLAB Answers>. Find all the elements of a vector wh...

más de 2 años hace

Resuelto


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...

más de 2 años hace

Resuelto


Longest Sequence of NaNs
In an array return the length of longest sequence of nans for each column. x = [ 2 3 1 2 5 6; nan nan 5 n...

más de 2 años hace

Resuelto


How close to a hole
Suppose you have a description of good places (ones) and bad places (zeros). You want to know your distance from a bad place (in...

más de 2 años hace

Resuelto


Combine Data With Gaps
Combine data sets a and b where the datasets have "gaps" or unique points. Example: Input a = [1,0; 2,1; ...

más de 2 años hace

Resuelto


Sum My Indices
Given inputs M and N (in that order), output an MxN matrix whose entries are equal to the sum of their indices. Example input...

más de 2 años hace

Resuelto


Hard limit function
Classify x data as if x>=0 then y=1 if x<0 then y=0 Example x = [ -2 -1 0 1 2] y = [ 0 0 1 1 1]

más de 2 años hace

Resuelto


Elements with highest local average
Input v is a row vector such that length(v)>3. Consider a sliding window of length 3 that is used to calculate the local average...

más de 2 años hace

Resuelto


Shuffle
Shuffle a vector by breaking it up to segments of |n| elements, and rearranging them in a reversed order. For example, the ve...

más de 2 años hace

Resuelto


Vector pop
Take |n| elements from the end of the vector |v| and return both the shorten vector |v| and the |n| elements in a separate vecto...

más de 2 años hace

Resuelto


Game of life - 01
Refer to <https://en.wikipedia.org/wiki/Conway's_Game_of_Life> given a set of cells (the initial state) represented by 1(l...

más de 2 años hace

Resuelto


Triangle of numbers
Create a matrix with the integers from 1 to |n| arranged in a triangular shape. Every row |i| of the matrix contains |i| inte...

más de 2 años hace

Resuelto


Check whether a Wordle guess is consistent with previous feedback
The game Wordle resembles the classic game Mastermind. Players try to guess a five-letter word, and after each guess they are to...

más de 2 años hace

Resuelto


Vector push
Append an element |x| to the end of the vector |v| and return both the extended vector and the new number of its elements. |x| c...

más de 2 años hace

Resuelto


Say something funny
Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

más de 2 años hace

Resuelto


Reverse the elements of an array
Reverse the order of elements in an array: eg: input X = [ 1 2 3 ; 4 5 6 ; 7 8 9 ] o...

más de 2 años hace

Resuelto


Pernicious Anniversary Problem
Since Cody is 5 years old, it's pernicious. A <http://rosettacode.org/wiki/Pernicious_numbers Pernicious number> is an integer w...

más de 2 años hace

Resuelto


Convert radians to degrees
Given input in radians, output to degrees

más de 2 años hace

Resuelto


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

más de 2 años hace

Resuelto


Splitting Square - Problem the second

más de 2 años hace

Resuelto


Splitting Triangle - Problem the first

más de 2 años hace

Resuelto


Finding neighbors of [-1:1] in a matrix....
Hello All! Well I found this one fun to figure out, all you have to do is make a matrix of 1's or 0's (true or false) that sh...

más de 2 años hace

Cargar más