Microsoft | SSE | Hyderabad | Reject

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-11-27Added By Anonymous
Source: Link

Round1:

The character enncoding is given as, 1 byte or 2 byte can make a character. For a 2 byte character, MSB of first byte is 1 and for 1 byte character, the MSB is 0

Given an array of bytes, remove the last character and return the number of bytes remaining.

Note: [1XXXXXXX 0XXXXXXX 1XXXXXXX] is an invalid case. Assume that the input will always be valid.

Example:

input: [0XXXXXXX 1XXXXXXX 1XXXXXXX]

output: 1

input: [1XXXXXXX 0XXXXXXX 0XXXXXXX]

output: 2

Round2:

Given a faulty DC, return all the connected DCs.

Soluyion: simple DFS or BFS on graph

Round3:

Q1:

Similar to https://leetcode.com/problems/predict-the-winner/ but return the maximum score that player1 can get. Consider that both player always want to maximize their own score and minimize opponent's score.

Q2:

Design LLD for single traffic light system with 4 road connected to it.

Any code/explanation for round1 and round3 questions is appreciated.

Thannk you.



Comments