I had to implement methods for selecting a table, row, or cell within a table and then set the color for the selection.
Interview Details
I encountered a new question during the online assessment that I hadn't seen before. The problem involved a Table class in FigJam where users can select the entire table, a single row, or a single cell and then set the color property on the entire selection. I needed to implement the following methods:
select_table()
select_row(row_index)
select_cell(row_index, column_index)
get_color(row_index, column_index)
set_color_on_selection(color)
The code was:
class Table:
def __init__(self, num_rows, num_columns):
self.num_rows = num_rows
self.num_columns = num_columns
# TODO
def select_table(self):
# TODO
def select_row(self, row_index):
# TODO
def select_cell(self, row_index, column_index):
# TODO
# Returns the color of the cell at (row_index, column_index)
def get_color(self, row_index, column_index):
# TODO
# Sets the given color on every cell in the current selection
def set_color_on_selection(self, color):
# TODO
def __repr__(self):
column_indices = list(range(self.num_columns))
row_divider = "".join(map(lambda x: '+---', column_indices)) + "+\n"
debug_string =
class Table:
def __init__(self, num_rows, num_columns):
self.num_rows = num_rows
self.num_columns = num_columns
# TODO
def select_table(self):
# TODO
def select_row(self, row_index):
# TODO
def select_cell(self, row_index, column_index):
# TODO
# Returns the color of the cell at (row_index, column_index)
def get_color(self, row_index, column_index):
# TODO
# Sets the given color on every cell in the current selection
def set_color_on_selection(self, color):
# TODO
def __repr__(self):
column_indices = list(range(self.num_columns))
row_divider = "".join(map(lambda x: '+---', column_indices)) + "+\n"
debug_string =
Unlock Full Details
Create a free account to unlock this interview experience report.