help to optimize code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help to optimize code

Hello All, Below is my code: https://code.sololearn.com/c3O64jI4S5Tm input and output is explained in code. Request your view on the same in terms of optimization. Thanks a lot for your input in advance...!

9th Jun 2020, 8:28 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
+ 1
I recommend dropping std::regex and never to use it again in C++. The standard library's regex is notorious for being slow. There are some good 3rd party libraries out there, I heard of some really good template based regex library that works at compile time with c++20 if you can use that ( I forgot the name ) which I kinda doubt here. So, unless you like to drink several cups of coffee while the program is compiling/running, I recommend just reading the numbers directly.
9th Jun 2020, 12:56 PM
Dennis
Dennis - avatar
0
Okay
9th Jun 2020, 2:14 PM
Ketan Lalcheta
Ketan Lalcheta - avatar