Iterate Ragged Integer Lists Vertically
Updated
Problem statement
rows is a possibly ragged list of integer lists. Read it one column at a time from left to right. Within a column, emit existing values from the first row to the last row.
Skip a row when it has no value in the current column. Return the complete vertical order.
Function
verticalIteration(rows: int[][]) → int[]Examples
Example 1
rows = [[1,2,3],[4,5],[6]]return = [1,4,6,2,5,3]Columns are traversed left to right and absent cells are skipped.
Example 2
rows = [[1,2],[3,4]]return = [1,3,2,4]A rectangular matrix is read column-major.
Constraints
0 <= rows.length <= 10000- The total number of integers is at most
100000.
More ZipRecruiter Onsite Interview questions
- Restaurant Vote LeadersPHONE SCREEN · ONSITE INTERVIEW · Seen Feb 2026
- Sliding Window Rate LimiterOA · ONSITE INTERVIEW · Seen Oct 2022
- Sort an Integer Array in Ascending OrderOA · ONSITE INTERVIEW · Seen Apr 2022
- Classify an Alien Dictionary OrderingPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
- Add Numbers Stored in Four-Digit ChunksONSITE INTERVIEW · Seen Nov 2021
- Add Two Numeric Strings with CarryONSITE INTERVIEW · Seen Nov 2021
- Expand Decimal Digits into Runs of OnesONSITE INTERVIEW · Seen Nov 2021
- Solve a Sudoku BoardONSITE INTERVIEW · Seen Aug 2021
- Validate a Sudoku BoardONSITE INTERVIEW · Seen Aug 2021
- Min StackONSITE INTERVIEW · Seen Feb 2017
Similar questions at other companies
- Rotate a Matrix by 90 DegreesIDFC Bank · ONSITE INTERVIEWIDFC Bank interview questions
- Rotate a Flat Image ClockwiseGoogle · ONSITE INTERVIEWGoogle interview questions
- Matrix MultiplicationeBay · ONSITE INTERVIEWeBay interview questions
- Validate a Two-Color ChessboardAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Traverse Interior Matrix Cells in Row-Major OrderCitadel · ONSITE INTERVIEWCitadel interview questions
- Detect a Winner on a 3x3 Tic-Tac-Toe BoardHebbia · ONSITE INTERVIEW
- Trace of a Square MatrixAkuna Capital · PHONE SCREEN · ONSITE INTERVIEWAkuna Capital interview questions
- Unique Rows of a Binary MatrixExpedia · ONSITE INTERVIEWExpedia interview questions
- Number of IslandsIntuit · ONSITE INTERVIEWIntuit interview questions
- Rotting OrangesSalesforce · ONSITE INTERVIEWSalesforce interview questions