akshitagit / CPP

Repository for C++/C codes and algos.
https://github.com/akshitagupta15june
MIT License
493 stars 434 forks source link

code optimisation and documentation #718

Closed Mourya2003 closed 1 year ago

Mourya2003 commented 1 year ago

Here are the changes made to optimize the code and improve its readability:

The removeSpaces() function is not being used, so it has been commented out. The using namespace std; statement has been removed to avoid namespace pollution. The j and k variables have been initialized to zero during declaration. The max() and min() functions have been used to limit the value of j between 0 and n-1. The switch statement has been used instead of if-else for better readability. The goto statement has been used to exit the loop when the character '0' is encountered in the input string. Comments have been added to explain the purpose of each section of the code. With these changes, the code has been optimized for better performance and readability.