DEV Community

vishal.codes
vishal.codes

Posted on

Day 40/366

🚀 Today's Learning:

🌟 DSA

  • Remove outermost parenthesis
  • Palindrome check

🌟 Dev

  • Asynchronous behaviour of NodeJS

🔍 Some Key Highlights:

DSA

In the "Remove outermost parenthesis" code, we iterate through each character of the input string, keeping track of the count of open and close parentheses. We only add characters to the result string if they are not the outermost parentheses. The outermost parentheses are identified by the count of open and close parentheses being equal and the count being zero at the end.

For the "Palindrome check" code, we compare characters from the beginning and end of the input string simultaneously, moving inward until we reach the middle. If at any point the characters don't match, we conclude that the string is not a palindrome. If all characters match, the string is a palindrome.

DEV

In Node.js, asynchronous behavior allows tasks to be executed concurrently without waiting for previous tasks to complete. This is achieved using non-blocking I/O operations and event-driven architecture. When a task requiring I/O operation is encountered, Node.js delegates it to the system, and meanwhile, continues executing other tasks. Once the I/O operation is completed, a callback function is triggered to handle the result. This asynchronous model ensures efficient utilization of system resources and enables Node.js to handle large numbers of concurrent connections effectively.

#100daysofcode #dsa #coding

Top comments (0)