Solved

Trimming Spaces

Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32). Input a = ' singular value deco...

18 jours ago

Solved

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

18 jours ago

Solved

Interpolator

You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

18 jours ago

Solved

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

18 jours ago

Solved

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

18 jours ago

Solved

Summation of array

Given an array, Find the sum of all of the elements in it Examples: Input x = [1 2 3 5; 4 5 6 7]; Output y is 33

18 jours ago

Solved

Return the Fibonacci Sequence

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

20 jours ago

Solved

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

20 jours ago

Solved

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

20 jours ago

Solved

Matrix to column conversion

Given a matrix of any size, convert it into a column vector. e.g A=[10 20 30; 40 50 60] then, B = [10; 40; ...

20 jours ago

Solved

Pangrams!

A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

25 jours ago

Solved

Return a list sorted by number of occurrences

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

25 jours ago

Solved

Create an n-by-n null matrix and fill with ones certain positions

The positions will be indicated by a z-by-2 matrix. Each row in this z-by-2 matrix will have the row and column in which a 1 has...

26 jours ago

Solved

Create a vector whose elements depend on the previous element

The idea is to create a vector A whose elements depend on the previous element : *A(i+1) = 2*A(i)+1* *2 Inputs*: - A : The...

26 jours ago

Solved

Insert zeros into vector

Insert zeros after each elements in the vector. Number of zeros is specified as the input parameter. For example: x = [1 ...

26 jours ago

Solved

Create an index-powered vector

Given a input vector x, return y as index-powered vector as shown below. Example x = [2 3 6 9] then y should be [...

26 jours ago

Solved

Find nth maximum

Find nth maximum in a vector of integer numbers. Return NaN if no such number exists. x = [2 6 4 9 -10 3 1 5 -10]; So ...

26 jours ago

Solved

Give prime Numbers upto n

You are given a input number x; print all the prime numbers less than equal to x.

28 jours ago

Solved

Pi Digit Probability

Assume that the next digit of pi constant is determined by the historical digit distribution. What is the probability of next di...

28 jours ago

Solved

Matlab Basics II - Count rows in a matrix

Write a function that returns that number of rows in a vector or matrix x example: x = [1; 2; 3] output = 3

28 jours ago

Solved

Back to basics 11 - Max Integer

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

28 jours ago

Solved

Given a square and a circle, please decide whether the square covers more area.

You know the side of a square and the diameter of a circle, please decide whether the square covers more area.

29 jours ago

Solved

Make a Palindrome Number

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

30 jours ago

Solved

Matrix with different incremental runs

Given a vector of positive integers a = [ 3 2 4 ]; create the matrix where the *i* th column contains the vector *1:a(i)...

30 jours ago

Solved

Bit calculation

Give me the count of numbers from 1 to n having their last two bits as 0. For example function y = ret_count(4) y = x...

30 jours ago

Solved

Mysterious digits operation (easy)

What is this digit operation? 0 -> 0 1 -> 9 121 -> 9 44 -> 6 15 -> 5 1243 -> 7 ...

30 jours ago

Solved

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

30 jours ago

Solved

Find the maximum number of decimal places in a set of numbers

Given a vector or matrix of values, calculate the maximum number of decimal places within the input. Trailing zeros do not coun...

30 jours ago