Rippling | Onsite [REJECT]

Hi everyone, just wrapped up my Onsite with Rippling yesterday and wanted to share one of the questions I was asked in the coding interview.

Question:
Given an nxm board write 3 functions display(), draw(char,size,pos_x,pos_y), and move(char, new_pos) to interact with the board.

Ex => n = 5, m =5
When we call display() the return result should be:
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

When we call draw('a',(2,2), 0, 0) this will draw in a character a in the top left of the board, but only when we call upon the display function.
so after:

draw('a',(2,2), 0, 0)
display()

We get this as a result
a a 0 0 0
a a 0 0 0
0 0 0 0 0
0 0 0 0 0

If we call draw('b',(2,2),1,0) since the character 'b' was drawn into the board recently we will overlap b with a since we want to maintain a priority for the recent called characters.

The result of display will return:
a b b 0 0
a b b 0 0
0 0 0 0 0
0 0 0 0 0

Finally for the move() function we will now give Users the option to move their existing draws in the board but we MUST maintain priority. For example since b was recently added into the board, we CANNOT overlap a with b.
The function move('a' , (1,1)) once display is called again will return us this board:

0 b b 0 0
0 b b 0 0
0 a a 0 0
0 0 0 0 0

NOTE
Your interviewer won't ask the same exact question with the given parameters but will most likely have the exact same logic for this given problem.

Comments (11)