Once upon a time in a land of yore, there was a troll Stefan who lived ’neath one of the land’s five stone bridges. This troll was quite a mischievous troll, for you see, it had a habit of accusing anyone crossing the bridge of having stolen the troll’s property (which was a somewhat curious accusation given that Stefan had no property), the punishment of which was to be eaten alive. Unfortunately for the troll, eventually the king got wind of its questionable business model, and sent out the valiant knights of the High Tavern to go, shall we say, Queen of Hearts, on the troll.
Apprehensive of its imminent decapitation, the troll fled, and did not have the decency to even leave a forwarding address. Being a troll, it was clear that the troll was hiding under some stone bridge, possibly different than the one it had used for its shady business practice, but which? The knights could search under one stone bridge per day (and travelling between bridges was done at lightning speed, thanks to the knights’ renowned iTravel™ technology). While clever enough to flee from its hunting ground, the troll is not bright enough to move to an arbitrary bridge: once the hunt starts, the troll will always move to an adjacent bridge. How many days would it take until the troll would surely have been found?
想問peter一條algo題
假設依家有條numeric string,
依家可以係任何位置放個 '+' or '-' 號, 令到條numeric string變成一條式
e.g
12345 可以變成 1+2-3+45
Q: now my input is "123456", find all solution such that the expression adds up to "45"
12 + 34 + 5 - 6 is one of the solutions