Lost in the Woods
Updated
Problem statement
A linear path starts with S and ends with D. Between them, . is a clear cell and * is an obstacle. Start at S. If the next cell is clear or D, emit W and walk to that cell. If the next cell is an obstacle, emit J and jump across the entire consecutive obstacle run, landing on the first clear cell or D after it. Stop on reaching D and return the signal string.
Function
woodsSignals(path: String) → StringExamples
Example 1
path = "S.**...*.**D"return = "WJWWJJ"Walk to the first clear cell, then alternate full-run jumps and clear-cell walks as shown.
Example 2
path = "S**.D"return = "JW"The jump lands on the clear cell after the obstacle run, then one walk reaches D.
Constraints
- The source gives a path length at most 100000. For this callable version, assume at least two cells, exactly one S at the start and D at the end, and only . or * in between.
More Intuit Online Assessment questions
- Employee Promotion OpportunitiesOA · Seen Oct 2026
- Next Pascal Row CoefficientOA · Seen Oct 2026
- Parse Router LogsOA · Seen Oct 2026
- Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
- Maximum Square-Free DivisorOA · Seen Oct 2026
- Two Tribes from Taller-Person CountsOA · Seen Oct 2026
- Shortest Path from an Encoded GraphOA · Seen Sep 2026
- Oldest and Youngest EmployeesOA · Seen Sep 2026
- Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
- Submask Sum QueriesOA · Seen Sep 2026
Similar questions at other companies
- Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
- Branch with the Most FilesCapital One · OACapital One interview questions
- REST API: Highest International StudentsRippling · OARippling interview questions
- Rearrange String by Alternating EndsHudson River Trading · OAHudson River Trading interview questions
- Filter Isolated Interior Signal BitsSEDEMAC · OA
- Scale Ingredient QuantitiesUpstart · OAUpstart interview questions
- Telephone Keypad String EncodingEpic · OAEpic interview questions
- Count Invalid Log GroupsIBM · OAIBM interview questions
- Count Case-Insensitive TripletsTikTok · OATikTok interview questions
- Simulate a Deterministic Finite AutomatonPoint72 · OAPoint72 interview questions