Solved

Duplicates

Write a function that accepts a cell array of strings and returns another cell array of strings *with only the duplicates* retai...

ongeveer 3 jaar ago

Solved

Find the peak 3n+1 sequence value

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

ongeveer 3 jaar ago

Solved

Return the 3n+1 sequence for n

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

ongeveer 3 jaar ago

Solved

Elapsed Time

Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...

ongeveer 3 jaar ago

Solved

Spot the First Occurrence of 5

This problem series invites you to solve two simple problems related to the integer NUMBER FIVE, in order to celebrate <https://...

ongeveer 3 jaar ago

Solved

Basic electricity in a dry situation

⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ &#...

ongeveer 3 jaar ago

Solved

MATLAB Counter

Write a function f = counter(x0,b) to construct a counter handle f that counts with an initial value x0 and a step size b. E...

ongeveer 3 jaar ago

Solved

Function Iterator

Given a handle fh to a function which takes a scalar input and returns a scalar output and an integer n >= 1, return a handle f...

ongeveer 3 jaar ago

Solved

Is it really a 5?

A number containing at least one five will be passed to your function, which must return true or false depending upon whether th...

ongeveer 3 jaar ago

Solved

Breaking Out of the Matrix

Do you want to take the Red Pill, or the Blue Pill? If you take the Blue Pill, you will simply pass along to the next problem...

ongeveer 3 jaar ago

Solved

Solitaire Cipher

Implement the <http://en.wikipedia.org/wiki/Solitaire_(cipher) solitaire cipher>. Since this is from Wikipedia, I am capturin...

ongeveer 3 jaar ago

Solved

How long is the longest prime diagonal?

Stanislaw Ulam once observed that if the counting numbers are <http://en.wikipedia.org/wiki/Ulam_spiral arranged in a spiral>, t...

ongeveer 3 jaar ago

Solved

Spot the outlier

All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

ongeveer 3 jaar ago

Solved

Find a subset that divides the vector into equal halves

Given a vector x, return the indices to elements that will sum to exactly half of the sum of all elements. Example: Inpu...

ongeveer 3 jaar ago

Solved

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

ongeveer 3 jaar ago

Solved

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]

ongeveer 3 jaar ago

Solved

Permute diagonal and antidiagonal

Permute diagonal and antidiagonal For example [1 2 3;4 5 6;7 8 9] -> [3 2 1;4 5 6;9 8 7] WITHOUT diag function (and variable n...

ongeveer 3 jaar ago

Solved

Weighted average

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

ongeveer 3 jaar ago

Solved

Longest run of consecutive numbers

Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

ongeveer 3 jaar ago

Solved

Get the elements of diagonal and antidiagonal for any m-by-n matrix

In the problem <http://www.mathworks.com/matlabcentral/cody/problems/858-permute-diagonal-and-antidiagonal Problem 858. Permute ...

ongeveer 3 jaar ago

Solved

Return a list sorted by number of consecutive occurrences

Inspired by Problem 38 by Cody Team. Given a vector x, return a vector y of the values in x sorted by the number of CONSECUTIVE...

ongeveer 3 jaar ago

Solved

The 5th Root

Write a function to find the 5th root of a number. It sounds easy, but the typical functions are not allowed (see the test su...

meer dan 3 jaar ago

Solved

Clock Hand Angle 1

Given a time in HH:MM:SS, find the smallest angle (in degrees) between the hour and minute hand

meer dan 3 jaar ago

Solved

N-th Odious

Given index n return n-th <https://oeis.org/A000069 odious number>.

meer dan 3 jaar ago

Solved

Find the biggest empty box

You are given a matrix that contains only ones and zeros. Think of the ones as columns in an otherwise empty floor plan. You wan...

meer dan 3 jaar 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...

meer dan 3 jaar ago

Solved

calculate PI without using pi function

There are many methods to get the pi(Ratio of circumference to diameter). You should get pi without using the pi function in M...

meer dan 3 jaar ago

Solved

Replace NaNs with the number that appears to its left in the row.

Replace NaNs with the number that appears to its left in the row. If there are more than one consecutive NaNs, they should all ...

meer dan 3 jaar ago

Solved

Remove all the words that end with "ain"

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

meer dan 3 jaar ago

Solved

Quote Doubler

Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote ...

meer dan 3 jaar ago