</>OfferRetriever
DashboardDiscuss
NEW

Summer Sale

Limited Time Deal: Unlock all premium questions for over 30% off

$10.42$7.08

14

:

03

:

46

:

47

Get this deal
Back to Dashboard

Wildcard Segment Counter

Hard

You are given a template string consisting only of the characters '0', '1', and '?', and a list of integers run_lengths.

A '?' in the template can be replaced by either '0' or '1'. After all replacements, the resulting binary string must have consecutive runs of '1's with lengths exactly matching run_lengths in order (with at least one '0' separating each run, and no extra '1's outside the runs). Count the number of distinct ways to replace all '?' characters so the resulting string satisfies this condition. ...

OfferRetriever

Master technical interviews with real questions from top companies. Build your confidence and career.

PRODUCT
PricingDashboardDiscussOfferRetriever vs LeetCode
LEGAL
POPULAR COMPANIES
GoogleMetaAmazonMicrosoftNetflixStripeUberTikTokBrowse all companies →

© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.