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, 21.06.2019 15:30
Some of the items below indicate the steps required to move a slide to a different location in a presentation. select those steps and indicate the order in which they should be performed to move the slide. (for example, if an item describes what you do first, select 1.) included in the list are items that are not part of the process. for these items, select n/a, an abbreviation for not applicable. 1 — first 2 — second 3 — third 4 — fourth 5 — fifth 6 — sixth n/a — not applicable drag the slide to the desired place. enter the slide position desired. hold the mouse button down. select move from the tools menu. select the slide. switch to the notes view.
Answers: 3
question
Computers and Technology, 22.06.2019 14:20
Cengagenowv2 is a comprehensive online learning tool. using cengagenowv2, you may access all of the following except: 2. each time you log in, cengagenowv2 automatically performs a system check and informs you if your computer does not meet the cengagenowv2 system requirements. 3. which tab/page allows you to easily track your assignment scores, number of submissions, time spent, as well as the ability view assign
Answers: 3
question
Computers and Technology, 22.06.2019 16:30
What type of file does a cookie place on web site visitors' computers so that web site managers can customize their sites to their visitors' preferences?
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
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, 02.11.2020 20:50
question
Physics, 02.11.2020 20:50
question
English, 02.11.2020 20:50
question
Mathematics, 02.11.2020 20:50
question
Mathematics, 02.11.2020 20:50
question
Mathematics, 02.11.2020 20:50
Questions on the website: 13722363