sumanas27 / Binary-Period

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binary-Period

Zalando codility test

This program is used to find Binary Period of a number.

Definition of a binary period : The period of this string is the smallest positive integer P such that: P ≤ Q / 2 and S[K] = S[K+P] for 0 ≤ K < Q − P. For example, 7 is the period of “abracadabracadabra”. A positive integer M is the binary period of a positive integer N if M is the period of the binary representation of N.

For example, 1651 has the binary representation of "110011100111". Hence, its binary period is 5. On the other hand, 102 does not have a binary period, because its binary representation is “1100110” and it does not have a period.

For example, 7 is the period of “pepsicopepsicopep”. A positive integer M is the binary period of a positive integer N if M is the period of the binary representation of N.

About


Languages

Language:Java 100.0%