Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

Shared Glyphs

Learn
Play
Prove
Problem context and objectives
Mission briefing

Rune decoder · Thousands of spells share the same opening symbols

Reuse shared prefixes to complete the requested spell: Shared Glyphs.

Checking every full spell makes each keystroke feel slow.

How you win

  1. 1Recognize when Prefix search matches the clues
  2. 2Keep this true after every move: every accepted character belongs to every word at that position
  3. 3Reach the result within O(total characters)

Rules and pressure

  • Target cost: O(total characters)
  • State rule: every accepted character belongs to every word at that position
Lesson 1 of 3

Live algorithm trace

Prefix search

Complete execution
1 of 5
flower
word
flow
flight

Use the first word as the initial candidate prefix.

1prefix = first word
2shrink until each word starts with prefix
3return prefix
prefix = flower
Truth to preserve / Cost target
Truth to preserve

every accepted character belongs to every word at that position

Cost target

O(total characters)

A trie shares paths for shared prefixes. Before building the full tree, the same idea can be practiced by walking character columns until the words disagree.

Your call · What should guide every step of this algorithm?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead