## Win After Last Round - Microsoft Top Interview Questions

You are given a list of integers nums of length n representing the current score of swimmers in a competition. There is one more round to swim and the first place winner for this round gets n points, second place n-1 points, etc. and the last place gets 1 point. Return the number of swimmers that can still win the competition after the last round. If you tie for first in points, this still counts as winning. Constraints n ≤ 100,000 where n is the length of nums Example 1 Input

## Word Machine - Microsoft Top Interview Questions

You are given a list of strings ops where each element is either: A non-negative integer that should be pushed into a stack "POP" meaning pop the top element in the stack "DUP" meaning duplicate the top element in the stack "+" meaning pop the top two and push the sum "-" meaning pop the top two and push top - second Return the top element in the stack after applying all operations. If there are any invalid operations, return -1. Constraints 1 ≤ n ≤ 100,000 wher

## Even Frequency - Facebook Top Interview Questions

Given a list of integers nums, return whether all numbers appear an even number of times. This should be done in \mathcal{O}(1)O(1) space. Constraints n ≤ 100,000 where n is the length of nums Example 1 Input nums = [2, 4, 4, 2, 3, 3] Output True Explanation Every number occurs twice. Example 2 Input nums = [1] Output False Explanation 1 occurs an odd number of times.

## Insert Into Linked List - Facebook Top Interview Questions

You are given a singly linked list head as well as integers pos and val. Insert a new node with value val before index pos of head. Constraints 1 ≤ n ≤ 100,000 where n is the number of nodes in head 0 ≤ pos ≤ n Example 1 Input head = [1, 3, 5, 7] pos = 2 val = 9 Output [1, 3, 9, 5, 7] Example 2 Input head = [1] pos = 0 val = 3 Output [3, 1] Example 3 Input head = [2] pos = 1 val = 5 Output [2, 5]

## Most Frequent Number in Intervals - Facebook Top Interview Questions

You are given a list of list of integers intervals where each element contains the inclusive interval [start, end]. Return the most frequently occurring number in the intervals. If there are ties, return the smallest number. Constraints n ≤ 100,000 where n is the length of intervals Example 1 Input intervals = [ [1, 4], [3, 5], [6, 9], [7, 9] ] Output 3 Explanation The most frequent numbers are [3, 4, 7, 8, 9] and they all occur twic