Console Row Word Filter
Preview mode. Log in to edit, run, submit, and save progress.
Console Row Word Filter
An old console is divided into physical character lanes. A word passes the lane audit if all of its letters can be typed using characters from exactly one lane. Matching is case-insensitive, but the returned word must keep its original casing from the input. Words that require letters from multiple lanes are rejected. The original order of accepted words must be preserved. Input Format: You are given an array rows describing lane characters and an array words. Output Format: Return all words that can be typed using a single lane.
Examples
rows = ["qwertyuiop", "asdfghjkl", "zxcvbnm"] words = ["Alaska", "Dad", "Peace", "type"]
Alaska Dad type
Explanation: Words ["Alaska", "Dad", "type"] can each be typed from one row only. Words ["Peace"] touch multiple rows and are skipped. Printed in original order, they give Alaska Dad type.
Approach hint
Look for the state that actually matters after each operation.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.