JP Morgan Chase & Co. organized its first round for internship hiring on 27th Feb 2021 for Software Engineer full-time analyst, 2022. The test was conducted on HackerRank. It had 2 coding questions for 1 hour 15 minutes. The difficulty level of these questions was medium.
- Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals and return an array of the non-overlapping intervals that cover all the intervals in the input.
Example 1: Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]. Example 2:Input: intervals = [[1,4],[4,5]] Output: [[1,5]] Explanation: Intervals [1,4] and [4,5] are considered overlapping.
- Suppose we have a string s, we have to find the count of contiguous substrings that have the same number of 0’s and 1’s, and all the 0’s and all the 1’s in these substrings are grouped consecutively. If substrings occur multiple times are counted the number of times they occur.
So, if the input is like “11001100”, then the output will be 6, as the substrings are “1100”, “10”,”0011″, “01”, “1100”, “10”.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.