Daily Coding Day Two Fourteen
This question, according to the email, was asked by Stripe. It’s a unique question, binary is always fun.
Question: Given an integer n, return the length of the longest consecutive run of 1s in its binary representation. For example, given 156, you should return 3.
They don’t say this but that is because 156 is 10011100
1 | function longestConsecutiveOnes(n) { |