JP Morgan ML DS Summer Intern OA


  1. 找出kth element

  2. Divide the list into sublists with k elements. The last sublist may contain fewer than k elements. Sort each sublist, get its median and append it to another list containing medians of sublists. If the medians list has a length more than k, compute its median recursively, proceeding with step 1. If the medians list has k elements or fewer, sort it and determine its median. Return it as a pivot. If an array is of odd length, the median is the middle element after the array has been sorted. If an array is of even length, there are two middle elements after it has been sorted. In this case, we will define the median as the left (first) of these two middle elements.

  3. A classic stock trading pattern happens when a 9-Day Moving Average (9-DMA) crosses the 50-Day Moving Average (50-DMA). This can be indicative of a bullish or a bearish setup, depending on the direction. When the 9-DMA crosses above the 50-DMA from below, it is Bullish. When the 9-DMA cross below the 50-DMA from above, it is Bearish. Write a program that reads in a series of dates and prices, calculates the 9-DMA and 50-DMA, then returns the dates of any bullish signals that occurred.

  4. Describe a time when you have worked as part of a successful team. What role did you play and what were the challenges you encountered?