Solved


Track Logic
A sensor produces either a hit (1) or a miss (0) for a given target once per scan. The sensor is also equiped with a tracker whi...

1 month ago

Solved


Hamiltonian Cycle
This is related to the Travelling Salesman Problem 1339 created by Alex P. A Hamiltonian cycle or traceable cycle is a path tha...

1 month ago

Solved


Convert a diagonal representation of a matrix element to linear index or subscripts
Elements in matrices in MATLAB can be retrieved by linear index or subscripts. For example, the 1 in the matrix below has a line...

1 month ago

Solved


Two Sum
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You m...

1 month ago

Solved


How Long is the Border Between Unitopia and Zerostan?
Two countries, Unitopia (denoted by ones) and Zerostan (denoted by zeros) are engaged in a long-standing dispute: how long is th...

1 month ago

Solved


Gather primes
A book titled Gather that I regularly see inspired this game: make as many words as possible from the letters in the word GATHER...

1 month ago

Solved


Leo Bậc Thang
Bạn đang leo cầu thang. Cần n bước để lên đến đỉnh. Mỗi lần bạn có thể leo 1 hoặc 2 bước. Hỏi có bao nhiêu cách khác nhau để le...

1 month ago

Solved


Find record values in a sequence
Write a function to find the record values in a sequence—that is, the largest values seen since the start. For example, if the s...

1 month ago

Solved


Jump Game
You are given an array of non-negative integers `nums`. You are initially positioned at the first index of the array, and each e...

1 month ago

Solved


Breaking straight lines
Let P be a point in Oxy plane and let p be a 1×2 array representing an one-degree or zero-degree polynomials, if its first entry...

1 month ago

Solved


Filled Diamond Pattern
Create an N×N binary matrix that forms a filled diamond shape centered in the matrix. The diamond expands symmetrically toward t...

1 month ago

Solved


Record the Actions ( Medium )
Find the minimum steps to get T units from jugs A and B. Return the sequence of actions as cell array of strings. Available act...

1 month ago

Solved


Find the nearest admirable number
Cody Problems 1012 and 2544 ask us to determine whether a number is perfect—that is, whether the sum of divisors is equal to ....

1 month ago

Solved


Mersenne Primes
A Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number. For example, 31 is a Mersenne prim...

1 month ago

Solved


Find the next prime number
Find the next prime number or numbers for given n. For example: n = 1; out = 2; or n = [5 7]; out = [7 11]; ...

1 month ago

Solved


Make a vector of prime numbers
Input(n) - length of vector with prime numbers Output(v) - vector of prime numbers Example: * n=1; v=2 * n=3; v=[2 3 5...

1 month ago

Solved


Largest Twin Primes
<http://en.wikipedia.org/wiki/Twin_prime Twin primes> are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Giv...

1 month ago

Solved


Find nearest prime number less than input number
Find nearest prime number less than input number. For example: if the input number is 125, then the nearest prime number whi...

1 month ago

Solved


Project Euler: Problem 7, Nth prime
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the Nth prime numb...

1 month ago

Solved


Circular Primes (based on Project Euler, problem 35)
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. The...

1 month ago

Solved


The Goldbach Conjecture
The Goldbach conjecture asserts that every even integer greater than 2 can be expressed as the sum of two primes. Given the eve...

1 month ago

Solved


Sophie Germain prime
In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

1 month ago

Solved


There are 10 types of people in the world
Those who know binary, and those who don't. The number 2015 is a palindrome in binary (11111011111 to be exact) Given a year...

1 month ago

Solved


Given an unsigned integer x, find the largest y by rearranging the bits in x
Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 since ...

1 month ago

Solved


Find the longest sequence of 1's in a binary sequence.
Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

1 month ago

Solved


Relative ratio of "1" in binary number
Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

1 month ago

Solved


Binary code (array)
Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector). Example: Inpu...

1 month ago

Solved


Bit Reversal
Given an unsigned integer _x_, convert it to binary with _n_ bits, reverse the order of the bits, and convert it back to an inte...

1 month ago

Solved


Binary numbers
Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

1 month ago

Solved


Rescale Scores
Each column (except last) of matrix X contains students' scores in a course assignment or a test. The last column has a weighted...

1 month ago

Load more