Microsoft | Phone Screen | Validates Excel Input

Anonymous User
471
Jan 24, 2022
Jan 26, 2022

I was asked the question during a Phone Screen Interview, it was written in a PDF, the description didn't make any sense to me, so I had to ask a lot of questions for the clarification.

Write a program that validates Excel inputs:

A1: Tiger |  B1: A2   | C1: B2 | D1: Lion | E1: A1 + B1 + C1 + D1
A2: runs  |  B2: with | C2:    | D2:      |

Output: Tiger runs with Lion
True 
Because the cell of E1 has non-empty values or reference of non-empty values.
A1: Tiger |  B1: A2   | C1: B2 | D1: Lion | E1: A1 + B1 + C2 + D2
A2: runs  |  B2: with |

Output: Tiger runs C2(no value) D2(no value)
False 
Because in the cell of E1, both C2 and D2 don't have any values.

I thought image makes more sense:
Case One is valid because every cell has value or value refers to the other cel:
image

Case Two is invalid because some cells have no values or no references at all:
image

Comments (1)