DEV Community

vishal.codes
vishal.codes

Posted on

Day 23/366

🚀 Today's Learning:

🌟 DSA

  • Check mirror in n-ary tree and Length of longest valid substring

🌟 Dev

  • Git branching and merging

🔍 Some Key Highlights:

DSA

To check the mirror in an n-ary tree, you start by comparing each child of a node with its corresponding mirror child. If they match, continue recursively checking the subtrees of both children. If any pair doesn't match, return false indicating the tree is not a mirror. If all pairs match, return true indicating the tree is a mirror.

To find the length of the longest valid substring, iterate through the string character by character. Keep track of the current opening and closing parentheses count. When encountering an opening parenthesis, increment the count; when encountering a closing parenthesis, decrement the count. If the count is negative at any point, reset it to zero. Track the maximum valid substring length encountered so far and return it at the end.

DEV

In git branching and merging, you begin by creating a branch from the main codebase to work on a new feature or fix a bug independently. This branch allows you to make changes without affecting the main codebase. Once your changes are complete and tested, you merge the branch back into the main codebase. During merging, git automatically combines the changes from the branch with the main codebase, resolving any conflicts if they arise. This allows multiple developers to work simultaneously on different features and merge their changes seamlessly into the main project.

#100daysofcode #1percentplusplus #coding #dsa

Top comments (2)

Collapse
 
yowise profile image
a.infosecflavour

Keep going! 🌞

Collapse
 
vishalmx3 profile image
vishal.codes

Thankyou !✨