All about problems in Volume 108. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
- New poster
- Posts: 2
- Joined: Tue Oct 19, 2010 1:14 am
I'm calculating Bell's numbers using Bell's triangle (as calculating Stirling numbers of the 2nd kind is too slow) and my custom BigInteger class to solve this problem and I get the correct answer, however I'm getting TLE. I keep only prev and current lines of the triangle to lower memory usage. I also only calculate until the line I need to get the requested Bell number. The algorithm is:
Code: Select all
prevLine = currLine;
number = currLine;
Are there optimizations to make in the algorithm or only in the add/copy methods of my BigInteger class?