Category: c / c++
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 scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Silver Medal” and “Bronze …
Although there are many available mortgage calculators out there, the principle of a simple mortgage calculator is really simple, which is based on the following math formula. where, the …
The RDTSC is the IA-32/IA-64 (or x86/x64) instruction that loads the current value of the processors’ time stamp into EDX:EAX registers. RDTSC is short for “Read Time-Stamp Counter”. It …
Imagine a link-list data structure, given an entry, you are asked to remove the item from the list. In C/C++, you may write something like this (CAUTION: the following …