FastPrepEdit Distance
Problems/Edit Distance

Edit Distance

Bloomberg LP logoBloomberg LP● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bloomberg new grad onsite interview. The report names the well-known Edit Distance problem, number 72, and notes that this dynamic-programming task was an uncommon Bloomberg question. Our version uses the standard edit-distance task and is about 70% the same as the reported question.

Given two strings word1 and word2, return the minimum number of operations needed to transform word1 into word2.

One operation may insert one character, delete one character, or replace one character.

Function

minDistance(word1: String, word2: String) → int

Examples

Example 1

word1 = "horse"word2 = "ros"return = 3

Replace h with r, delete the second r, and delete e.

Example 2

word1 = "intention"word2 = "execution"return = 5

Five insert, delete, or replace operations are sufficient and optimal.

Example 3

word1 = ""word2 = "abc"return = 3

Insert the three characters of the target.

Constraints

  • 0 <= word1.length, word2.length <= 500.
  • Both strings contain only lowercase English letters.

More Bloomberg LP Onsite Interview questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Minimum Insertion Steps to Make a String PalindromeInfosys · ONSITE INTERVIEWInfosys interview questions
  • Wildcard MatchingTripjack · ONSITE INTERVIEWTripjack interview questions
  • Concatenated WordsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Interleaving StringsCARS24 · ONSITE INTERVIEW
  • Minimum Stickers to Form a Target StringByteDance · ONSITE INTERVIEWByteDance interview questions
  • Longest Valid ParenthesesMathWorks · ONSITE INTERVIEWMathWorks interview questions
  • Word Break II: All SentencesMicrosoft · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
  • Longest Valid ParenthesesMaven Clinic · ONSITE INTERVIEWMaven Clinic interview questions
  • Word Break IIGoogle · ONSITE INTERVIEWGoogle interview questions
  • Maximum Bouquet ValueOracle · ONSITE INTERVIEWOracle interview questions

Interview reports that mention this question

  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
  • Bloomberg New Grad OOD Follow-ups: 14 Experiences (Part 3 of 5)

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int minDistance(String word1, String word2) {
        // Write your code here.
    }

}
Checking account…