Roman numerals are a numeral system that originated in ancient Rome and remained the usual way of writing numbers throughout Europe well into the Late Middle Ages. Numbers in this…
Given an unsigned integer, try to calculate its square root value without using the math.sqrt() function. Sample Input: 10 Sample Output: 3.162277660168379 The square root value for 10 is 3.162277660168379.…
Two binary trees are identical when they have same data and arrangement of data is also same. To identify if two trees are identical, we need to traverse both trees…
The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases by 1 meter. A Utopian Tree sapling with a height of 1 meter is planted at…
In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the…
The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from…
Two strings are called isomorphic if one-to-one mapping is possible for every character of the first string to every character of the second string. Sample Input: s1 = "feel", s2…
In number theory, a happy number is a number which eventually reaches 1 when replaced by the sum of the square of each digit. For instance, 13 is a happy number because 12…