Implemented a recursive & non-recursive solution to analyze balanced substrings.
Developed a loop-based approach to detect the longest balanced substring.
Used algorithm optimization techniques for better performance.