Bloomberg | Phone Interview | New Grad
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-05-28Added By Anonymous
Source: Link
Company: Bloomberg
Role: New Grad
Stage: Phone Interview
Location: unknown
Year: unknown
Original Post:
A labyrinth of zeros and ones is given. Zero - "cannot pass", One - "can pass."
List all paths from top left to bottom-right corner. You can move only down or to the right.
Input: 2-dimensional array that contains the labyrinth.
Example:
Input = [[1,0,1], [1,1,1], [0,1,1]]
Input in 2D:
1 0 1
1 1 1
0 1 1
Output:
(0,0) (1,0) (1,1) (2,1) (2,2)
(0,0) (1,0) (1,1) (1,2) (2,2)
if impossible to reach bottom-right corner, print "No paths."
Please feel free to post your solutions!
Role: New Grad
Stage: Phone Interview
Location: unknown
Year: unknown
Original Post:
A labyrinth of zeros and ones is given. Zero - "cannot pass", One - "can pass."
List all paths from top left to bottom-right corner. You can move only down or to the right.
Input: 2-dimensional array that contains the labyrinth.
Example:
Input = [[1,0,1], [1,1,1], [0,1,1]]
Input in 2D:
1 0 1
1 1 1
0 1 1
Output:
(0,0) (1,0) (1,1) (2,1) (2,2)
(0,0) (1,0) (1,1) (1,2) (2,2)
if impossible to reach bottom-right corner, print "No paths."
Please feel free to post your solutions!