FastPrepDrop a Connected Figure Through Obstacles
Problems/Drop a Connected Figure Through Obstacles

Drop a Connected Figure Through Obstacles

ZipRecruiter logoZipRecruiter● MediumFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter OA image describes the grid symbols, one connected rigid figure, downward gravity, collision with the bottom or with obstacles, and the final grid. We supplied a String[] input and limits. The employment label is not known, so FULLTIME is used.

A rectangular grid uses . for empty, # for obstacles, and F for one orthogonally connected rigid figure.

Move the complete figure downward as far as possible without any figure cell leaving the grid or overlapping an obstacle. Return the final grid.

Function

dropFigure(grid: String[]) → String[]

Examples

Example 1

grid = [".F.",".F.","...",".#."]return = ["...",".F.",".F.",".#."]
grid
0120.F.1.F.2...3.#.
→
return
0120...1.F.2.F.3.#.
Moved or new

The figure falls one row before its lower cell would hit the obstacle.

Example 2

grid = ["F..","..."]return = ["...","F.."]
grid
0120F..1...
→
return
0120...1F..
Moved or new

The figure falls to the bottom.

Constraints

  • 1 <= rows,columns <= 200

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Rotate Matrix Regions Around the DiagonalsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Rotate Matrix Regions Around the DiagonalsHudson River Trading · OAHudson River Trading interview questions
  • Robot Navigation Around LasersRoblox · OARoblox interview questions
  • Leaves Remaining After Wind GustsOpenAI · OAOpenAI interview questions
  • Apply a Reversi MoveAmazon · OA
  • Flip, Invert, and Smooth a Binary ImageAbridge · OAAbridge interview questions
  • Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
  • First Completed Mingo LineEpic · OAEpic interview questions
  • Sort Every Matrix Border LayerCapital One · OACapital One interview questions
  • Rotate a Square Matrix ClockwiseVisa · OAVisa interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String[] dropFigure(String[] grid) {
        // Write your code here.
    }

}
Checking account…