Problem 44720. God of War: The Chains Of Olympus
The Spartan warrior, Kratos, is held by a chain of n > 1 links in the underworld. His only chance of survival is to break the chain by removing the minimum number of single link, so that it would be possible to create a chain of any integer length between 1 and n links, inclusive, from the resulting pieces. He only has enough stamina to remove the minimum number of single links. Anything more, and he forever remains doomed in the underworld.
At what points should he break chain to free himself and continue his vengeance journey to Olympus?
ILLUSTRATION:
n = 3 link chain can be broken, such that the resulting pieces can combine to give a chain of any integer length between 1 and n links, inclusive, by removing a minimum of a single link in any of the following way:
Segments Breakpoints O OO [1] O O O [2] OO O [3]
You are to return only one of these possible breakpoints i.e. either 1, 2, or 3 will be accepted as a correct solution for n = 3.
Similarly, n = 8 link chain can only be broken by removing a minimum of two single link as shown:
Segments Breakpoints
O OO O OOOO [1,4]
O OOOO O OOO [1,5]
O OOOO O OO [1,6]
O O O O OOOO [2,4]
O O OO O OOO [2,5]
O O OOO O OO [2,6]
O O OOOO O O [2,7]
OO O O OOOO [3,4]
OO O O O OOO [3,5]
OO O OO O OO [3,6]
OO O OOO O O [3,7]
OO O OOOO O [3,8]
OOO O O OOO [4,5]
OOO O O O OO [4,6]
OOO O OO O O [4,7]
OOO O OOO O [4,8]
OOOO O O OO [5,6]
OOOO O O O O [5,7]
OOOO O OO O [5,8]
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems

The Goldbach Conjecture, Part 2
2305 Solvers

Arrange Vector in descending order
10706 Solvers

220 Solvers

Wind outward from the center ...
80 Solvers

1365 Solvers
More from this Author18
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!