employer cover photo
employer logo
employer logo

NCR Corporation

Now known as NCR Voyix

Is this your company?

NCR Corporation Interview Question

Given a Connect4 array, write a function connect4(pieceColor, column) to judge if a winning condition is reached.

Interview Answer

Anonymous

Oct 25, 2018

The way he asked the question was pretty confusing. I was not sure if I should write two functions, one for updating the board and one for judging if a winning condition is reached. I ended up doing a O(n) function for updating board, and another O(1) function to see if there is a horizontal, vertical, or diagonal connected 4 pieces. Not sure if that's right. I think it can be done by DP