All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General
String length differences (Posted on 2005-02-15) Difficulty: 3 of 5
Consider the sequence 0100111100
There are 5 zeroes and 5 ones in this sequence.
The longest string of ones is 4.
The longest string of zeroes is 2.
The difference in string lengths is 2.

Create a sequence consisting of 100 zeroes and 100 ones which maximizes the difference in lengths between the longest string of 1's and the longest string of 0's.

Find a formula for the maximum difference in string lengths with n zeroes and n ones.

  Submitted by Jer    
Rating: 4.0000 (3 votes)
Solution: (Hide)
With 100 of each the greatest difference is 82. There are 10 strings of 10 zeroes interspersed with 8 single ones and a single string of 92 ones.

The formula for the second part is int(x+2-2sqrt(x)) which I can't seem to give a good proof of.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Puzzle Thoughts K Sengupta2023-06-23 02:03:17
Solutionsolutionrajeshkumar2005-02-20 07:53:35
SolutionWithout peekingLarry2005-02-17 21:01:07
Solution to part 1Steve Herman2005-02-15 15:27:17
SolutionsolutionCharlie2005-02-15 15:23:00
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information