JPMC | SDE | 14 November
Question · Posted Apr 2020
Given a 2D matrix of n rows and columns. Each cell(pixel) has a value from 0-255. The first n/3 rows represent colour red, next n/3 rows colour green and then n/3 row represent blue. You have to output a single 1-d array containing 8bit binary value for each pixel. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Here first 2 rows represent Red,THEN GREEN THEN BLUE output= [1,7 ,13,2,8,14,3,9,15,4,10,16 and ...
The full answer & interview discussion are available to premium members.
Log in Create a free account