DEV Community

Paolo Ventura
Paolo Ventura

Posted on

Day 22

Finally I caught up... so the publishing dates of my blog are in order!

We had a code dojo at work:

Palindromic Substring (DCP)

Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one.
For example, the longest palindromic substring of "aabcdcb" is "bcdcb". The longest palindromic substring of "bananas" is "anana".

I paired with my fantastic colleague and we tried to implement a recursive solution. We got it working but it failed after a while due to high o(n)

I then:

Watched this video

Now:

I am going to do some more substring problems as I could definitely work on these

Overall Learning Point:

I think sometimes doing the brute force really helps to visualize and work towards a solution. So being quick at working out the brute force way is a super useful technique.

Top comments (0)