AI summary by TwinMind

What's The Longest Word You Can Write With Seven-Segment Displays?

Tom Scott

8m 56s

Seven-Segment Display Background

  • Seven-segment displays historically used everywhere: clocks, supermarket checkouts, calculators, slot machines
  • Less common now due to cheaper screens
  • Featured at Centre for Computing History Cambridge on Megaprocessor showing clock speed
  • Design: 7 segments = minimum required to show all numbers using straight lines
  • Number 4 display differs from handwritten but universally accepted
  • 7 segments + decimal point = 8 lights total
  • Convenient for computers: 8 bits = 1 byte, can store all states in single byte
  • Can display some letters (e.g., "Error") and base-16 numbers
  • Cannot display M or W

Programming Challenge Setup

  • Question: What is longest English word displayable on seven-segment display?
  • Multiple solution approaches possible
  • Uses public-domain English word list (link in description)
  • List contains ~370,000 words
  • Contains questionable entries (e.g., two spellings of 'aarrgh')
  • Manual filtering possible for strange results

Technical Implementation

  • Language: JavaScript using Node.js
  • Reasoning: beginner-friendly, easy to explain
  • Boilerplate code sourced from Google search results
  • Programming philosophy: Breaking down problems > memorizing syntax
  • File handling: loads dictionary into single string, converts to array using newline characters

Letter Feasibility Analysis

  • Letters A-F: easy, almost standard representations
  • G: difficult, alternate patterns look like C with aspirations - ruled out
  • I: acceptable, clearly distinguishable
  • K: impossible, requires diagonal - ruled out
  • M: seen before but rejected
  • N: borderline but allowed (nothing else it could be)
  • Q: ruled out (just a 9)
  • R: allowed if lowercase
  • S: acceptable
  • V, W, X: impossible - ruled out
  • Z: impossible, needs diagonals - ruled out
  • Final count: 18 letters allowed, 8 disallowed

Code Implementation Details

  • Uses regular expression (regex) for efficiency
  • Disallowed letters: [gkmqvwxz] (later expanded to include i and o)
  • Regex matches any word containing forbidden letters
  • Filter approach: prioritizes readability over efficiency
  • Acceptable for single-use command line tool
  • Would need optimization for large-scale applications (YouTube/Google scale)

Algorithm Logic

  • Initialize empty string: longestAcceptableWord
  • Loop through each word in dictionary
  • Skip words shorter/equal to current longest (continue statement)
  • Test remaining words against regex for bad letters
  • Update longest word if passes both tests
  • Continue until all words processed

Results and Refinement

  • Initial result: longest word was already longest in entire list
  • Refinement: ruled out I and O (numbers with aspirations)
  • Final answer provided (specific word not mentioned in transcript)
  • Limitation noted: algorithm only finds one answer, multiple words of same length possible

Programming Concepts Discussed

  • Trade-off between fast code vs. understandable code
  • Mention of Big O notation (future video topic)
  • Regular expressions complexity
  • Continue statement usage debate
  • Importance of code clarity for future reference

TwinMind

Get summaries like this for your own meetings

TwinMind takes notes in the background during meetings, lectures, and calls, then writes the summary for you.

Free plan to get started

No bot joins your calls

Phone, desktop & Chrome apps

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome

Your next meeting, summarized like this

TwinMind listens in the background and turns meetings, lectures, and calls into searchable notes you can chat with. Start free.

Available on phone, desktop & Chrome