PracHub
QuestionsPremiumLearningGuidesCheatsheetNEW
|Home/Coding & Algorithms/Bloomberg

Solve Grid Path and Unique Substring

Last updated: May 2, 2026

Quick Overview

This question evaluates algorithmic problem solving skills in grid traversal and stateful string processing, specifically testing understanding of path search in a matrix and techniques for finding longest substrings without repeats.

  • medium
  • Bloomberg
  • Coding & Algorithms
  • Software Engineer

Solve Grid Path and Unique Substring

Company: Bloomberg

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Take-home Project

You are given two independent coding problems. For each problem, provide an implementation and analyze the time and space complexity. ### Problem 1: Find a string in a grid Given an `m x n` grid of characters and a target string `word`, determine whether `word` can be formed by a path in the grid. Rules: - The path may start from any cell. - Each next character must come from a horizontally or vertically adjacent cell. - A grid cell may be used at most once in the same path. - Return `true` if such a path exists; otherwise return `false`. Example: ```text grid = [ ['A','B','C','E'], ['S','F','C','S'], ['A','D','E','E'] ] word = "ABCCED" Output: true ``` ### Problem 2: Longest substring with all unique characters Given a string `s`, return the length of the longest contiguous substring that contains no repeated characters. Example: ```text s = "abcabcbb" Output: 3 Explanation: One longest valid substring is "abc". ``` After solving it with the common linear-time approach, also describe or implement an alternative linear-time solution that does **not** explicitly maintain a sliding window by repeatedly moving a left boundary pointer. For example, you may maintain the last index of each character and a dynamic programming value representing the length of the longest valid substring ending at the current position.

Quick Answer: This question evaluates algorithmic problem solving skills in grid traversal and stateful string processing, specifically testing understanding of path search in a matrix and techniques for finding longest substrings without repeats.

Related Interview Questions

  • Solve meeting and tree problems - Bloomberg (easy)
  • Minimize travel cost with two cities - Bloomberg (easy)
  • Check connectivity between two subway stations - Bloomberg (easy)
  • Design a data structure for dynamic top‑K frequency - Bloomberg (hard)
  • Find tree root and bucket numbers - Bloomberg (hard)
Bloomberg logo
Bloomberg
Jan 29, 2026, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
1
0
Loading...

You are given two independent coding problems. For each problem, provide an implementation and analyze the time and space complexity.

Problem 1: Find a string in a grid

Given an m x n grid of characters and a target string word, determine whether word can be formed by a path in the grid.

Rules:

  • The path may start from any cell.
  • Each next character must come from a horizontally or vertically adjacent cell.
  • A grid cell may be used at most once in the same path.
  • Return true if such a path exists; otherwise return false .

Example:

grid = [
  ['A','B','C','E'],
  ['S','F','C','S'],
  ['A','D','E','E']
]
word = "ABCCED"
Output: true

Problem 2: Longest substring with all unique characters

Given a string s, return the length of the longest contiguous substring that contains no repeated characters.

Example:

s = "abcabcbb"
Output: 3
Explanation: One longest valid substring is "abc".

After solving it with the common linear-time approach, also describe or implement an alternative linear-time solution that does not explicitly maintain a sliding window by repeatedly moving a left boundary pointer. For example, you may maintain the last index of each character and a dynamic programming value representing the length of the longest valid substring ending at the current position.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Bloomberg•More Software Engineer•Bloomberg Software Engineer•Bloomberg Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.