Generate binary combinations for a given number of bit(s) - MATLAB Cody - MATLAB Central

Problem 1488. Generate binary combinations for a given number of bit(s)

Difficulty:Rate

Generate the binary combination as in the example below.

Example: If you are given:

 bin_comb(2)

The answer will be:

 0 0
 0 1
 1 0
 1 1

The answer will appear in double class.

Solution Stats

50.0% Correct | 50.0% Incorrect
Last Solution submitted on Apr 20, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...

Problem Recent Solvers94

Suggested Problems

More from this Author16

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!