Company: Mercer | Mettl_13oct

Difficulty: medium

Problem Statement

Inverted Triangles Problem Description A garment designer wants to decorate a T-shirt with diamond-shaped patches arranged so that some of them line up into inverted right-angled triangles. The planned patch positions are marked out, but counting how many such triangles appear in the layout by eye is proving difficult. The layout is given as a matrix A whose entries are only 0 (no patch) or 1 (a patch). Determine and return how many inverted right-angled triangles are present in this layout. Input Specification: input1: An integer value representing the number of rows in the Matrix A. input2: An integer value representing the number of columns in the Matrix A. input3: An integer matrix A of size input1 x input2 representing the design of the T-shirt, where A[i][j] represents the contents of the i th row and the j th column in the input Matrix A. Output Specification: Return an integer value representing the number of inverted right-angled triangles that will come up in the T-shirt. The

More Mercer | Mettl_13oct OA questionsInterview experiences