4 ms·
Hi, I ran your code and it does run well. However fails for large cases such as pascal(200000). You mentioned you worked for Google and Amazon, how can you m
by zyzzy 15y ago
Hi,
I ran your code and it does run well. However fails for large cases such as pascal(200000).
You mentioned you worked for Google and Amazon, how can you modify the code to get an answer for pascal(200000)
- haberman 15y agoYeah, for large cases the long will overflow (also it will do a lot of realloc()). Your two main options for this are: 1. use double to get approximately-correct answers 2. use an abitrary-precision library like GMP
- zyzzy 15y agoWhat if I wanted an exact precision. Could I use a custom data type to get better precision? If I used a custom data type, how could I make the code work for a distributed system to get parallel behavior?