I am new to this forum, but not to the Rust Language. I have been learning rust since 4 months or so.
I also do have interest in Competitive Programming, but I found out that there was no guide for the same in Rust. The most basic guides Solving interactive problems and function to take input were not there in Rust.
So, I created this website, Rust Programming For guiding how to do Competitive Programming in Rust.
I have been actively developing it, and would like to get reviews about this.
I will be adding guides like default data structures, graphs, dynamic programming etc. slowly but surely.
Not to mention this is an open source project, you can visit its Github repo
So, yeah, that should be it. Please review the website, if you are interested!
Any comments, issues and merge requests will be welcome, regarding content as well as overall structure of website.
When people write their code using your templates, it'll be messy and quickly written. However, when they want to use your functions, they will likely be reading your code to know exact semantics. Hence, make sure to run your template code through something like rustfmt.
You don't need type annotations on local variables, since their types can be inferred.
Your take_string() function doesn't yield a String... it yields a Vec<char>. This takes up 4x the space (for ascii input) and is expensive to actually compute (you need to pull apart utf8 data). It'd be better to provide:
As an alternative to the extended Euclidean algorithm, Euler's theorem may be used to compute modular inverses.
This method is generally slower than the extended Euclidean algorithm, but is sometimes used when an implementation for modular exponentiation is already available. Some disadvantages of this method include:
The relative cost of exponentiation. [...] the standard binary exponentiation, which requires division mod m at every step, is a slow operation when m is large.
To be frank, when I learnt the Modular Multiplicative Inverse, I understood the Fermat's little solution and had not enough time to read and understand the Extended Euclidean Algorithm at all ( I had exam in 3-4 days ).
Plus Fermat's Little Solution works perfectly fine. Like you are almost as good as Extended Euclidean Algorithm when m <= 10^5, differing at max a few milliseconds at max. I have submitted a few CP questions using this, and all went smooth. So I didn't bother.