Largest Same-Letter Grid Component
Updated
Problem statement
Cells are connected through shared sides, not diagonals. A component contains cells with the same letter. Return the letter belonging to the largest component; break equal-size ties by lexicographically smallest letter.
Return the empty string for an empty grid.
Function
largestLetterComponent(grid: String[]) → StringExamples
Example 1
grid = ["abbcz","ampbg"]return = "a"The a and b components both have size two, so the lexical tie rule selects a.
Constraints
- The rectangular grid has at most
10^6cells.
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
- Number of IslandsFleetx · ONSITE INTERVIEW
- Number of IslandsIntuit · ONSITE INTERVIEWIntuit interview questions
- Number of IslandsAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Shortest Bridge Between Two IslandsCompass International Holdings · ONSITE INTERVIEWCompass International Holdings interview questions
- Number of Islands with Diagonal ConnectivityGoogle · ONSITE INTERVIEWGoogle interview questions
- Island Count and Maximum AreaOracle · ONSITE INTERVIEWOracle interview questions
- Number of Closed IslandsSnap Inc. · ONSITE INTERVIEWSnap Inc. interview questions
- Foreground Region SizesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- The MazeGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
- Mouse and Cheese ReachabilityMeta · ONSITE INTERVIEWMeta 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)