ML Interview questions

Common MLE Interview question from • SQL • DS & Algo • Product / Analytical questions • ML algos • ML system design • Statistics

799. Champagne Tower

Finding this could be solved using palindrome sequence was the real deal

🧑🏻‍💻 LC 169. Majority Element

Given an array num of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times.

Input: nums = [2,2,1,1,1,2,2]
Output: 2

The difficulty was in solving it in linear time O(n) and constant space O(1).
Solution: Use Boyer-Moore Voting Algorithm, choose a candidate element and +1 if same -1 if different if 0 then change candidate element.

lc 127. Word Ladde

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk

Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
Output: 5

lc: 532 k diff pair

Brute force: T:O(nlogn) S:(n) -> Sorting + set
Time Optimal: T:(n) S:O(n) -> dictionary based
Space Optimal: T(nlogn) S:O(1) -> Sorting + 2 pointer

LC

Map-reduce follow-up question + external sort: https://leetcode.com/problems/intersection-of-two-arrays-ii/

Best time to buy and sell stocks: kadane's algo

Lyft customer service use case

https://www.pramp.com/question/lK4AoGA0E5SgKL5MLmVw