chooseCached function

int chooseCached(
  1. int n,
  2. int r
)

Implementation

int chooseCached(int n, int r) {
  if (!_chooseCache.containsKey(n)) {
    _chooseCache[n] = {};
  }

  if (!(_chooseCache[n])!.containsKey(r)) {
    _chooseCache[n]![r] = choose(n, r, useCache: false);
  }

  return _chooseCache[n]![r]!;
}