List of all binary combinations for a number in Java

后端 未结 6 1009
后悔当初
后悔当初 2021-01-14 05:15

I am working on a project involving \"Dynamic Programming\" and am struck on this trivial thing, please help.

Suppose I take 4 as an input, I want to display somethi

6条回答
  •  遥遥无期
    2021-01-14 06:02

    • Get input n
    • Count from i=0 to (2^n) - 1
    • for each value of i bitmask each bit of i and display.

提交回复
热议问题