Community Profile

photo

Rafael Cruz


UFMG - Brazil

Attivo dal 2012

Statistiche

  • Commenter
  • Promoter
  • Speed Demon
  • Solver

Visualizza badge

Content Feed

Visto da

Risolto


Sorted highest to lowest?
Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

oltre 11 anni fa

Risolto


Remove the air bubbles
Given a matrix a, return a matrix b in which all the zeros have "bubbled" to the top. That is, any zeros in a given column shoul...

oltre 11 anni fa

Risolto


Television Screen Dimensions
Given a width to height ratio of a TV screen given as _w_ and _h_ as well as the diagonal length of the television _l_, return t...

oltre 11 anni fa

Risolto


Back to basics 10 - Max Float
Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive floating-point number MATLAB can han...

oltre 11 anni fa

Risolto


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

oltre 11 anni fa

Risolto


Sum of diagonal of a square matrix
If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

oltre 11 anni fa

Risolto


Return the largest number that is adjacent to a zero
This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

oltre 11 anni fa

Risolto


Balanced number
Given a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to...

oltre 11 anni fa

Risolto


Making change
Given an amount of currency, return a vector of this form: [100 50 20 10 5 2 1 0.5 0.25 0.1 0.05 0.01] Example: Input a = ...

oltre 11 anni fa

Risolto


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

oltre 11 anni fa

Risolto


Back to basics 12 - Input Arguments
Covering some basic topics I haven't seen elsewhere on Cody. Return a value equal to the number of input arguments to the fun...

oltre 11 anni fa

Risolto


Back to basics 8 - Matrix Diagonals
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...

oltre 11 anni fa

Risolto


Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

oltre 11 anni fa

Risolto


Remove DC
Input x is the sampled signal vector, may have both AC and DC components. Output y should not contain any DC component. Examp...

oltre 11 anni fa

Risolto


Back to basics 6 - Column Vector
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector, output true or false whether it is a colu...

oltre 11 anni fa

Risolto


Too mean-spirited
Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

oltre 11 anni fa

Risolto


Nearest Numbers
Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

oltre 11 anni fa

Risolto


Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

oltre 11 anni fa

Risolto


Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

oltre 11 anni fa

Risolto


Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

oltre 11 anni fa

Risolto


Target sorting
Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

oltre 11 anni fa

Risolto


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

oltre 11 anni fa

Risolto


De-dupe
Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

oltre 11 anni fa

Risolto


Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

oltre 11 anni fa

Risolto


How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

oltre 11 anni fa

Risolto


Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

oltre 11 anni fa

Risolto


Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

oltre 11 anni fa

Risolto


Weighted average
Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

oltre 11 anni fa

Risolto


Summing digits
Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...

oltre 11 anni fa

Risolto


Who Has the Most Change?
You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

oltre 11 anni fa

Carica altro