Find Longest Chain
Updated
Problem statement
Given a dictionary of many words:
- bac, ac, a, c, bads
For each word, each time you can delete one letter, and the resulting word must still be in the dictionary. The task is to find the longest chain that can be formed.
Function
longestChain(words: String[]) → intExamples
Example 1
words = ["bac", "ac", "a", "c", "bads"]return = 3The longest chain that can be formed starting with "bac" is "bac" -> "ac" -> "a", which has a length of 3.
Constraints
🍓🍓More Bloomberg LP interview questions
- Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Count Distinct Arrays After Decrement OperationsOA · Seen Nov 2026
- Minimum BeautyOA · Seen Nov 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
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
Similar questions at other companies
- Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
- Longest String ChainVisa · OAVisa interview questions
- Minimum Edit-Distance String for Each QueryTarget · OA
- Maximum Taxi EarningsWells Fargo · OAWells Fargo interview questions
- Max Sum of Non-Overlapping IntervalsAmazon · OA
- Maximize Power Values Sum 🪴Google · OAGoogle interview questions
- Platform Referral RewardsScale AI · OAScale AI interview questions
- Maximum Coin Tower HeightExpedia · OAExpedia interview questions
- Shipping Starts and Terminal DestinationsIntuit · OAIntuit interview questions
- Weighted Jobs from an Encoded Test CaseJP Morgan Chase · OAJP Morgan Chase interview questions
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)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)