How to calculate Binomial Coefficient (nCr) in O(r) time complexity

The recomputations in calculating binomial coefficient (nCr) can be avoided by exploiting optimal substructure and overlapping subproblems