Black Friday Sale: 20% off Premium yearly · $105.60 for the first year · until Monday, Nov 30Get it

Deep-ML
Learn
ProblemsPractice, projects, collections, and your progressLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      21 of 130

      How many typos?

      A spell-checker suggests the dictionary word closest to what was typed. Write typos(a, b): the fewest single-letter fixes that turn word a into word b, where a fix is replacing one letter, inserting one, or deleting one.

      Someone typed “kiten”. A spell-checker compares it with every dictionary word and suggests the one with the fewest typos. Counting letter by letter gets it wrong: one missing letter shifts everything after it. The goal is a list like the one it ends on. Your typos(a, b) counts the fixes.

      Someone typed “kiten”. Which word did they mean? The one with the fewest typos.typed:kitendid you mean…fixeskittenkitemittensitting
      Your functiontypos(a, b)
      athe word that was typed, e.g. "kiten"e.g. "cat"
      ba dictionary word to compare it with, e.g. "kitten"e.g. "cat"
      returnsthe fewest single-letter fixes (replace one letter, insert one, or delete one) that turn a into b
      solution.pyLoading Python
      Sign in for an AI hint
      ← Shared interestsColors into numbers →