## 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.

View Solution →## 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]

View Solution →## 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

View Solution →## Noisy Palindrome - Facebook Top Interview Questions

You are given a string s containing lowercase and uppercase alphabet characters as well as digits from "0" to "9". Return whether s is a palindrome if we only consider the lowercase alphabet characters. Constraints 0 ≤ n ≤ 100,000 where n is the length of s Example 1 Input s = "a92bcbXa" Output True Explanation If we only consider the lowercase characters, then s is "abcba" which is a palindrome. Example 2 Input s = "abZ" Output False

View Solution →## Strictly Alternating List - Facebook Top Interview Questions

You are given a list of integers nums. Return whether the list alternates from first strictly increasing to strictly decreasing and then strictly increasing etc. If a list is only strictly increasing, return true. Constraints 2 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [1, 2, 5, 7, 4, 1, 6, 8, 3, 2] Output True Explanation This list strictly increases, strictly decreases, strictly increases, then strictly decreases. Example 2

View Solution →