What's time complexity of this algorithm for finding all combinations?

后端 未结 4 1578
梦如初夏
梦如初夏 2020-12-09 03:51

Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
For example

4条回答
  •  攒了一身酷
    2020-12-09 04:51

    The time complexity is equal to the number of combinations there are.

    In this case it is n choose k.

提交回复
热议问题