Microsoft SDE-1 phone screen - US
Summary
I had a 1-hour phone screen for an SDE-1 position at Microsoft in the US, which included an intro, project discussion, and two coding questions. I could not solve the first question and only shared the approach for the second, leading to a likely rejection.
Full Experience
I recently had a 1-hour phone screen for an SDE-1 position at Microsoft in the US. The interview started with a 15-minute introduction and a discussion about my projects. The remaining 45 minutes were dedicated to coding, where I was asked two distinct questions. Unfortunately, I struggled with the first problem and could only outline an approach for the second. I believe this performance has likely resulted in a rejection.
Interview Questions (2)
Given a weight-to-character mapping: 'a' = 1, 'b' = 2*'a' + 'a', 'c' = 3*'b' + 'b', 'd' = 4*'c' + 'c', and so on up to 'z' = 26*'y' + 'y'.
The task is to return the shortest length of string that can be formed for a given total weight w.
Examples:
getString(3): string output can be "aaa" or "b". The output should be "b" as it has a shorter length.getString(25): output "cca"
The interviewer provided a hint to solve this using binary search: find the exact index where the weight matches the mapping and then keep on reducing the weight with the maximum value less than or equal to the current remaining weight. It was suggested to focus on creating a list for the mapping instead of a dictionary, as the mapping itself needs to be created.
The pre-calculated values for A-Z were provided as:
[1, 3, 12, 60, 360, 2520, 20160, 181440, 1814400, 19958400, 239500800, 3113510400, 43589145600, 653837184000, 10461394944000, 177843714048000, 3201186852864000, 60822550204416000, 1216451004088320000, 25545471085854720000, 562000363888803840000, 12926008369442488320000, 310224200866619719680000, 7755605021665492992000000, 201645730563302817792000000, 5444434725209176080384000000]
Given a person's work schedule in the form of a string s, along with totalWeekHours and dailyWorkHours, the task is to provide all variations of the string s that can be formed.
The '?' characters in the string s need to be replaced with digits such that when all digits in the string are summed up, the result equals totalWeekHours. The replacement digit for each '?' must be between 0 and dailyWorkHours (inclusive).
Examples:
s = "1234?5?7",totalWeekHours = 25,dailyWorkHours = 5Replace '?' such that 1+2+3+4+?+5+?+7 equals 25.workschedule("89??233", 40, 8)could return a list like['8978233', '8987233'](where '*' represents a placeholder digit).
This problem was identified as a variation of the LeetCode Combination Sum problem.