FastPrepRotate a Rectangular Image Clockwise
Problems/Rotate a Rectangular Image Clockwise

Rotate a Rectangular Image Clockwise

Luma AI logoLuma AI● EasyFULLTIMEOA
QuestionFunctionExamplesConstraints

Problem statement

Source note: A first-hand Luma AI assessment gives the full rectangular grayscale-image rotation contract. The practice task preserves that contract and matches the report at about 99%.

Given an H × W grayscale integer image, return a new W × H image rotated 90 degrees clockwise.

Function

rotateClockwise(image: int[][]) → int[][]

Examples

Example 1

image = [[1,2,3],[4,5,6]]return = [[4,1],[5,2],[6,3]]

The first output row is the original first column read bottom to top.

Constraints

  • 1 <= H, W <= 200.
  • Every row has exactly W entries.

More Luma AI problems

  • Build a Gaussian Blur KernelOA · Seen Jun 2026
  • Center Crop a Grayscale ImageOA · Seen Jun 2026
  • Impute Missing Values and Normalize ColumnsOA · Seen Jun 2026
All Luma AI interview questionsSee Luma AI hiring insights
Saved
class Solution {
    public int[][] rotateClockwise(int[][] image) {
        // Return a 90-degree clockwise rotation.
    }
}
Checking account…