Solved


Make a simplified barcode
Given an integer to encode, make a barcode using the following encoding scheme: * The bar code is made from the binary versio...

14 years ago

Solved


The Birthday Phenomenon
First off, leap years are not being considered for this. In fact the year that people are born shouldn't be taken into considera...

14 years ago

Solved


Retirement savings
At the start of what year will you have reached or exceeded a savings goal? Parameters (all are constant scalars given in a s...

14 years ago

Solved


Recurrence relation
A recurrence relation is given by P(1) := 1 P(n+1) := exp(1) - (n+1)*P(n) Write a function that, given an integer |...

14 years ago

Solved


More luck than brains
Give a random function that guess and return numbers from 1 to 6 exactly like the test suite .

14 years ago

Solved


"Look and say" sequence
What's the next number in this sequence? * [0] * [1 0] * [1 1 1 0] * [3 1 1 0] * [1 3 2 1 1 0] This a variant on the w...

14 years ago

Solved


Reduce - Map-Reduce
Write reduce function, that takes arguments and constantly folds results into next call argument, finally returning a value; ...

14 years ago

Solved


Repopulate the City
For any population p of positive integers between pmin and pmax, we can calculate histogram count n for a list of evenly dividin...

14 years ago

Solved


Greed is good - Simple partition P[n].
Find a simple partition P[n]. E.g. P[10] = 4 + 3 + 2 + 1. # There are many solutions, compute just one set. # Don't repeat ...

14 years ago

Solved


Create a patchwork matrix
This function will assemble a large matrix out of a number of smaller ones m1, m2, etc., according to a pattern P. If P is 3x5,...

14 years ago

Solved


Matrix indexing with two vectors of indices
Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).

14 years ago

Solved


All Humans are Created Equal - Pareto Equality
One way or the other two sets of identical types can come out ahead of the other by idea of Pareto equality. Pareto equality b...

14 years ago

Solved


middleAsColumn: Return all but first and last element as a column vector
Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

14 years ago

Solved


Implement a counter
Write a function that returns a function that counts the number of times it is invoked. Example: >> h = counter; >> h() ...

14 years ago

Solved


Function composition - harder
Write a function that accepts an arbitrary number of function handles f_1, f_2, ..., f_n and returns the composition h. That is,...

14 years ago

Solved


Function composition
Write a function that accepts two function handles f and g and returns the composition h. That is, h = (f o g)(x) = f(g(x)) ...

14 years ago

Solved


Spiral In
Create an m by n matrix filled with sequential integers starting from 1 and arranged in a counterclockwise spiral that hugs the ...

14 years ago

Solved


Return elements unique to either input
Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

14 years ago

Solved


Sort numbers by outside digits
Sort the array so that they are sorted as if their value was a 5 digit number made from the first three and last two digits of t...

14 years ago

Solved


Encoding Google Maps Polylines
This problem is based on the Google Polyline Encoder algorithm. This is how Google Maps encodes a line for display on a map. You...

14 years ago

Solved


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

14 years ago

Solved


Boolean algebra
Your contractor from Elbonia has sent you the prototype of the new logical unit. It turns out that the only logical relation it ...

14 years ago

Solved


Sum of first n terms of a harmonic progression
Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....

14 years ago

Solved


Transposition as a CIPHER
This all about transcripting a text message. If the input string is: *s1 = 'My name is Sourav Mondal'*, then the output is: *s2...

14 years ago

Solved


How to add?
* Imagine you are in 2222 Anno Domini, when everyone must learn how to add, * and competing for the highly prestigious post of,...

14 years ago

Solved


Find the jerk
No, it's not the author of this problem... Jerk is the rate of change in acceleration over time of an object. So, if given t...

14 years ago

Solved


Set defaults
Write a function that computes the volume of a cube. The function should be able to accept three inputs: the length, width, and...

14 years ago

Solved


Find best domino orientation
Given a list of pairs, find the orientation they should be placed in a line, such that the sum of the absolute values of the dif...

14 years ago

Solved


Choose the best fitting dominoes
You will be given a cell array of nx2 matrices. Choose one row from each matrix. These are the ordered pairs that will be plac...

14 years ago

Solved


Find best placement for ordered dominoes (harder)
Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

14 years ago

Load more