Category: math
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. For example, given two integers x=1 and y=4, the hamming distance …
Given an array of numbers (for simplicity, we use integers), find the maximum value of abs(max left – max right) where we separate the array into two. Mathematically, given …
Assume a year has 365 days, what is the probability among 50 students, that at least two having the same birthday? Let’s consider this: what is the probability that …
A Sparse Matrix (SM) is a popular data structure that is used to stored two-dimension Matrix when the total the empty/zero elements are the majority in the matrix. For …
C/C++, unfortunately, does not have a sgn function in its standard library however this is defined in the Boost library. template <class T> inline int sign (const T& z); …