Question: Please write the following function in Scheme/Dr.Racket and check-expect. Dr.Racket is PLT Scheme programming language. A bitstring is a list of 0's and 1's: Example:
Please write the following function in Scheme/Dr.Racket and check-expect. Dr.Racket is "PLT Scheme programming language".
A bitstring is a list of 0's and 1's: Example: (list 1 0 0 1 1 0 1 0 0 1 1 1 1)
Write a function that takes in a bitstring and returns the length of the longest consecutive string of 0s or 1s. For example, the longest string of consecutive bits in the above list is of length 4.
;Hint: You will need 3 accumulators. One will hold the current ;maximum length, one will hold the length of the current string, ;and another will hold whether the last bit was a 0 or 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
