Reported September 2024
Ciscostring

Find Palinedrome Sub String

Reported by candidates from Cisco's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Cisco OA. Under 2s to a working solution.
Founder's read

Cisco's September OA included a palindrome substring problem, and it's a classic string pattern question that catches candidates off guard. You're looking for the longest palindromic substring in a given string, or sometimes just checking if one exists. The trap is trying to brute force every possible substring and check it, which works but gets slow fast. StealthCoder will catch the pattern instantly if you blank on the approach during the live OA.

Pattern and pitfall

The key insight here is that you don't need to check every substring independently. Expand around each center: for each character (and each pair of characters for even-length palindromes), expand outward while characters match. This is O(n^2) time and O(1) space, which beats the naive approach. The common mistake is forgetting to handle both odd-length and even-length palindromes in the same loop, or not tracking the longest one found. Another option is dynamic programming with a table, but expansion is cleaner under time pressure. StealthCoder handles both strategies and will show you the working code if you get stuck.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Find Palinedrome Sub String cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as longest palindromic substring. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Cisco's OA.

Cisco reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find Palinedrome Sub String FAQ

What's the actual trick here?+

Expand around centers, not substring iteration. For each position, treat it as the center of an odd-length palindrome, then treat each adjacent pair as the center of an even-length one. Track the longest as you go. Much faster than checking all substrings.

Do I have to return the substring or just the length?+

The problem text wasn't provided, so check the exact output format when the OA loads. Usually you return the substring itself. Track the start and end index of the longest palindrome you find, not just the length.

Will dynamic programming solutions pass?+

Yes, a DP table works fine. Build a table where dp[i][j] is true if s[i:j+1] is a palindrome. It's O(n^2) time and space. Expansion is faster in practice and uses no extra space, but either passes.

How hard is this really for Cisco?+

It's medium-level. Not a trick question, just a classic string pattern. If you know the expand-around-centers trick, you'll code it in 15-20 minutes. Without it, you'll struggle with brute force runtime.

What if the string is empty or has length 1?+

Every single character is a palindrome. Edge case: empty string might return empty string or an error depending on the spec. Read the constraints carefully when the OA loads.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Cisco.

OA at Cisco?
Invisible during screen share
Get it