Combinations Of String While Maintaining Order Of Words

前端 未结 3 1561
庸人自扰
庸人自扰 2021-01-24 20:17

Given a string:

String words = \"Mary had a little lamb\";

how to obtain a combination of sentence fragments while the order of occurrence of w

3条回答
  •  清酒与你
    2021-01-24 20:43

    You have 4 word delimiters (spaces) here. Every space may be replaced (or not) by sentence delimiter. So there are 16 = 2^4 cases, which correspond to binary numbers 0000...1111.

提交回复
热议问题