# FB Onsite

**Stage 3: Virtual Onsite**

* Interview 1: Coding Challenge

  * Challenge 1

    * Write a function that accepts an array of numbers and returns the length of the longest monotonic subsequence

    <https://leetcode.com/problems/longest-increasing-subsequence/>

  ```
  class Solution:
      def lengthOfLIS(self, nums: List[int]) -> int:
          n = len(nums)
          if n == 0:
              return 0
          dp = [1]*n
          
          for i in range(n):
              for j in range(i+1,n):
                  if nums[j] > nums[i]:
                      dp[j] = max(dp[j],dp[i]+1)
          return max(dp)
  ```

  * Challenge 2

    * Write a function that accepts a tree and returns the length of the longest path between any two nodes

* Interview 2: System Design
  * Problem
    * You're working on a music streaming app. How would you build a feature to show users their top 10 most-played songs each week?
    * Interviewer had follow-up questions, and also asked about things like how to measure the feature's success, and what other similar/related features can be built on top of this

* Interview 3: Behavioral
  * Was asked several behavioral questions about how I would handle a certain scenario or to talk about past challenges/successes

* Interview 4: Coding Challenge
  * something like [leetcode #460 - subarray sum equals k](https://leetcode.com/problems/subarray-sum-equals-k/)
