Check Pattern Presence
Reported by candidates from DataBricks's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
DataBricks asked this in August 2024 and the title alone is doing heavy lifting here. You're looking at a string or pattern matching problem where you need to detect if a substring, regex pattern, or character sequence exists in a given input. No fancy tricks announced in the title, which means the catch is probably in the edge cases: empty strings, special characters, or case sensitivity. This is the kind of problem where candidates blank on handling null inputs or forget to consider overlapping matches. StealthCoder can read the exact input format and constraints when you see them and suggest the pattern in real time if you freeze.
Pattern and pitfall
The core pattern is likely string-matching or basic searching, possibly with regex if the problem is testing pattern recognition beyond simple substring checks. You're probably iterating through the input, comparing against a target pattern, and returning a boolean or count. The trick isn't algorithmic complexity here. It's specification. Does the pattern need to be contiguous or can it be scattered across the string. Is it case-insensitive. Are there special regex metacharacters to handle. Candidates often write working code for the happy path and fail on the constraints they didn't read carefully. That's where StealthCoder acts as your second pair of eyes during the live OA, catching what you might skim in the problem statement.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Check Pattern Presence 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 StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass DataBricks's OA.
DataBricks 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.
Check Pattern Presence FAQ
Is this a regex problem or plain string matching?+
Without the full problem text, assume plain substring/character matching first. If the title says 'pattern' and the input includes regex syntax, then yes, regex is likely required. Start simple and escalate to regex only if the test cases demand it.
What's the most common mistake on 'Check Pattern Presence' style problems?+
Not handling overlapping matches or empty pattern edge cases. If the pattern is empty, many languages return true by default. Also watch for case sensitivity. Test your solution on both 'abc' and 'ABC' before submitting.
How do I prepare in 48 hours if I'm weak on string matching?+
Review the built-in string methods in your language (indexOf, contains, find, in operator). Understand the difference between exact match, substring, and regex. Write three toy examples: match a word, match a repeating character, match with wildcards.
Is this problem asking for the presence or the count?+
The title 'Check Pattern Presence' strongly suggests boolean return (true/false or yes/no). If the problem wants a count or positions, the title would likely say so. Clarify before coding.
What if the pattern uses special characters or regex syntax?+
Check if the input is a literal string or if regex is explicitly mentioned in the problem. If regex, use your language's regex library (re module in Python, regex crate in Rust, Pattern in Java). Test your regex on a regex tester site first.