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

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

3 Monate ago

Solved

Find the palindrome

Given the string a, find the longest palindromic sub-string b. So when a = 'xkayakyy'; you should return b = 'kayak';

3 Monate ago

Solved

Given two strings, find the maximum overlap

Given two strings s1 and s2, create a new string s3 which is as short as possible and contains both strings. If s1 = [1 2...

3 Monate ago

Solved

Summing Digits within Text

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

3 Monate ago

Solved

DNA N-Gram Distribution

Given a string s and a number n, find the most frequently occurring n-gram in the string, where the n-grams can begin at any poi...

3 Monate ago

Solved

Pattern matching

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

3 Monate ago

Solved

Mandelbrot Numbers

The <http://en.wikipedia.org/wiki/Mandelbrot_set Mandelbrot Set> is built around a simple iterative equation. z(1) = c z...

3 Monate ago

Solved

Calculate the Levenshtein distance between two strings

This problem description is lifted from <http://en.wikipedia.org/wiki/Levenshtein_distance>. The Levenshtein distance betwee...

3 Monate ago

Solved

Extract leading non-zero digit

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

3 Monate ago

Solved

Knight's Tour Checker

Given a matrix a, determine whether or not a legal <http://en.wikipedia.org/wiki/Knight's_tour knight's tour> is present. The kn...

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

3 Monate ago

Solved

Pangrams!

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

3 Monate ago

Solved

Test for balanced parentheses

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

3 Monate ago

Solved

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

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

3 Monate ago

Solved

The Goldbach Conjecture, Part 2

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

3 Monate ago

Solved

What is the next step in Conway's Life?

Given a matrix A that represents the state of <http://en.wikipedia.org/wiki/Conway's_Game_of_Life Conway's game of Life> at one ...

3 Monate ago

Solved

ゼロでない要素が一番多い行を探そう

行列 a が与えられたとき、行列 a の中で一番ゼロの要素が少ない行のインデクス r を返す関数を作成しましょう。このとき、行列 a には一つだけしかこの条件に当てはまる行がないと仮定します。 例: 入力として、行列 a = [ 1 ...

3 Monate ago

Solved

Counting in Finnish

Sort a vector of single digit whole numbers alphabetically by their name, in Finnish. See the Wikipedia page for <http://en.wik...

3 Monate ago

Solved

Remove the polynomials that have positive real elements of their roots.

The characteristic equation for a dynamic system is a polynomial whose roots indicate its behavior. If any of the <http://www.ma...

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

3 Monate ago

Solved

Prime factor digits

Consider the following number system. Calculate the prime factorization for each number n, then represent the prime factors in a...

3 Monate ago

Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

3 Monate 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, ...

3 Monate ago

Solved

Duplicates

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

3 Monate ago

Solved

Longest Divisor Run

Given the vector a, find the longest run of consecutive numbers that can be evenly divided by the same number d where d > 1. ...

3 Monate ago

Solved

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

3 Monate ago

Solved

Encode Roman Numerals

Create a function taking a non-negative integer as its parameter and returning a string containing the Roman Numeral representat...

3 Monate ago

Solved

Find relatively common elements in matrix rows

You want to find all elements that exist in greater than 50% of the rows in the matrix. For example, given A = 1 2 3 5 ...

3 Monate ago