subject

Abinary gap within a positive integer n is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of n. e. g.: the number 20 has binary representation 10100 and contains one binary gap of length 1. the number 15 has binary representation and has no binary gaps. write a function: class solution { public int binary_gap(int n); } that, given a positive integer n, returns the length of its longest binary gap. the function should return 0 if n doesn't contain a binary gap.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
In outlook how can cherie look at the details of an event that appears on the month view of her calendar? check all that apply. by switching to the detail view by switching to the week view by switching to the day view by right-clicking on the event by double-clicking on the event by highlighting the event
Answers: 2
question
Computers and Technology, 22.06.2019 19:00
If your accelerator suddenly gets stuck what should you do
Answers: 2
question
Computers and Technology, 22.06.2019 19:20
Write a program that reads a file consisting of students’ test scores in the range 0–200. it should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. output the score ranges and the number of students. (run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)
Answers: 3
question
Computers and Technology, 23.06.2019 10:30
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
You know the right answer?
Abinary gap within a positive integer n is any maximal sequence of consecutive zeros that is surroun...
Questions
question
Mathematics, 12.08.2021 08:00
question
Mathematics, 12.08.2021 08:00
question
Computers and Technology, 12.08.2021 08:00
question
Biology, 12.08.2021 08:00
question
Physics, 12.08.2021 08:00
Questions on the website: 13722363