A checkout funnel logs events as letters in events: a for add-to-cart, b for begin-checkout, and c for complete-purchase. An analyst wants to know how many slices of the log contain at least one of each event type.
Write countFullSlices(events) that returns the number of non-empty runs of neighboring events that contain at least one a, one b, and one c.
Input: events = "abcabc" Output: 10
Every slice of length 3 or more contains all three letters: 4 + 3 + 2 + 1 = 10.
Input: events = "aaacb" Output: 3
aaacb, aacb, and acb.
0 <= events.length <= 100000events contains only a, b, and c.Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #148 Slices With Every Event Type. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.