I recently interviewed at Stripe, which consisted of five rounds, including a screening round. While I cannot disclose specific questions, I compiled a list of interview experiences from Stripe's Glassdoor section, which could be beneficial to others.
Process : same as explained here
https://medium.com/tech-pulse/no-leetcode-the-stripe-interview-experience-cf1b29e6f55d
We can assume that the input string contains tokens separated by a single whitespace.
The function will then replace all of the digits with an "x" character
EXCEPT for the last 4 digits for that token.
It will then return the full string with the data redacted.
Examples
// 16 digit number gets redacted, other tokens will not be touched
redact_card_numbers("1234567890123456 is a number")
returns "xxxxxxxxxxxx3456 is a number"
// No credit card found, no transformation needed
redact_card_numbers("basic_string 12345 no redaction")
returns "basic_string 12345 no redaction"
// 16 digit number in the middle of the string is redacted, other tokens are left alone.
redact_card_numbers("an embedded number 1234567890123456 in the string")
returns "an embedded number xxxxxxxxxxxx3456 in the string"
PART 2
Fortunately, credit card numbers have some additional structure to them.
For example:
Similar to leetcode account balancing . https://leetcode.com/problems/optimal-account-balancing/description/
Part1 :
Given a String, split it into major parts separated by special char / (slash).
For each major part that’s split by /, we can further split it into minor parts separated by . (dot).
We assume the given Strings:
., /)."/a", "a/", "./..").Produce a final output String such that for each minor part, we only keep the first and last letter of it, interpolated with the count of letters in between.
Function to implement :
String compress_part_one(String s) {
return compressed_s;
}
Given input =>
stripe.com/payments/checkout/customer.maria
output =>s4e.c1m/p6s/c6t/c6r.m3a
For example, imagine compressing a URL such as "section/how.to.write.a.java.program.in.one.day".
After compressing it by following the rules in Part 1, the second major part still has 9 minor parts after compression.
Task: Therefore, to further compress the String, we want to only keep at most m (m>0) compressed minor parts from Part 1 within each major part.
If a major part has more than m minor parts, we keep the first (m-1) minor parts as is,
but concatenate the first letter of the m-th minor part and the last letter of the last minor part with the count of letters in the original string.
This means that if you build on top of results that have numeronyms, you should expand
on the numbers to count the number or letters in the original String, e.g, "w1w.s4e.c1m"
should be compressed into "w10m" instead of "w7m" (go through the examples below). You can either reuse Part 1 output or not.
If a major part has less than or equal to m minor parts, keep all the individual minor parts as they are from Part 1.
Example :
Given:
str = stripe.com/payments/checkout/customer.maria.doe
minor_parts = 2
(after Part 1 compression)
=>
s4e.c1m/p6s/c6t/c6r.m3a.d1e
(then after Part 2 compression)
=>
s4e.c1m/p6s/c6t/c6r.m6e
Step-by-step guide for part 2 compression:
String compress_part_two(String str, Int minor_parts) {
// You can either use results from compress_part_one(str) or not.
return compressed_s;
}
its only one part .
https://leetcode.com/problems/minimum-penalty-for-a-shop/description/