Find the majority element in an array.
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
Input: nums = [3, 2, 3]
Output: 3
Explanation: The number 3 appears 2 times, which is strictly greate…
Alien Dictionary Order
Derive the alien dictionary order from a sorted list of alien words.
Input: words = ["z","x","z"]
Output: "" (Empty String)
Explanation: The letter 'z' cannot come before 'x' and then suddenly after 'x', creating a cycle and making the dictionary invalid.
Best Time to Buy and Sell Stock
You have access to an array where each element represents the price of a specific stock on a given day. Your objective is to maximize profit by selecting one day to purchase the stock and a different, future day to sell it. Determine and return the maximum profit achievable. If it's impossible to generate…
Describe a specific situation where a model you deployed to production unexpectedly underperformed. How did you detect it, diagnose the root cause, and fix it?
Palindromes in Base-10 and Base-k
Return the first n integers that are palindromes in both base-10 and base-k.
Input: n = 2, k = 4
Output: [1, 5]
Explanation: 1 is '1' in base 4, and 5 is '11' in base 4. Both are perfect palindromes in decimal and base 4 simultaneously.