DP on Strings
Each problem here reduces a string to a small state and builds it up one character at a time. Counting valid words with a cap on consecutive vowels only needs the length of the vowel run at the end. Two disjoint palindromic subsequences need a bitmask showing which indices the first one took. A Premium question needs two numbers, how far into the text and how far into the pattern you've matched.
The first two have come up on Snowflake's online assessment, and the third in a senior phone screen. On the assessment, hidden tests decide the score, so the constraint line at the bottom of each prompt matters more than the recurrence. With at most 12 characters, brute force over masks is the intended approach. Counts taken modulo 1e9 + 7 need the reduction on every multiply. And since a regex has to match the whole text, a search that stops at the first partial match is solving a different problem.
RLIKE is anchored at both ends, the same contract as is_match here, so say "whole value" before drawing the grid.SnowflakePremium lesson · Coding round
The 3 Snowflake problems are below.
- A Premium questionCoding · Medium · Frequently asked
- A Premium questionCoding · Medium
- A Premium questionCoding · Hard
Each with hints, the follow-up and a tested solution.
Get the Snowflake questions$49 a year · all 100 companies · cancel anytime
From 111 Snowflake reports, forum threads behind logins and write-ups in Chinese.
Snowflake interview guideKnow what Snowflake asks before you walk in.
31 coding · 5 system design · 18 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.