Before December 2014, Youtube used a 32-bit signed integer to record down the number of Youtube views of a particular video.
What is the most number of views that would be displayed?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
@Tawfiq Hamid , we really liked your comment, and have converted it into a solution. If you subscribe to this solution, you will receive notifications about future comments.
One Can use summation to solve This one, we have in base 2: n m a x = 1 1 1 1 … 1 1 32 times
So in base 10 it would be: n m a x = n = 0 ∑ 3 1 2 n
wich is: n m a x = 2 3 1 − 1
Since the smallest number of views is 0 and the views include all 2 3 2 positive integers after 0 , the maximum number of views would be 2 3 2 − 1 .
Related:
There is 1 type of people. Those who start listing from 1 and those who don't.
But is it broken when it lists the maximum number of views, or when it can't list the correct number of views?
why not 2*32 +1
Its 2^31 -1, not 2^32 -1
Problem Loading...
Note Loading...
Set Loading...
A 32 bit integer could take values upto 2^32 - 1. In practice Youtube were using a signed integer which means 1 bit was used to dictate whether the number was positive or negative, hence the value was only stored by 31 bits.
Therefore in practice only 2^31 -1 views were counted before the view count overflowed.