As you know, now I’m pursuing my master’s in computer science ( if you don’t, now you know lol), and it’s an internship hunting period for us despite of difficult economy, we have to give it try.
I applied for Mathworks through the career page for an EDG Intern role and got the OA a few weeks later.
- Online Assessment: There was a choice between two category
- Two Coding questions ( in any programming language )
- 50 Matlab MCQ
I choose to go with the first option as the second is out of my league and the platform is Hackerrank.
1. Leetcode: https://leetcode.com/problems/break-a-palindrome/
Given a palindromic string of lowercase English letters palindrome, replace
exactly one character with any lowercase English letter so that the resulting string is not a
palindrome and that it is the lexicographically smallest one possible.
Return the resulting string. If there is no way to replace a character to
make it not a palindrome, return an empty string.
Input: palindrome = "abccba"
Explanation: There are many ways to make "abccba" not a palindrome,
such as "zbccba", "aaccba", and "abacba".
Of all the ways, "aaccba" is the lexicographically smallest.
Hint: Check for edges case too
2. Leetcode: https://leetcode.com/problems/distinct-subsequences/
Given two strings s and t, return the number of distinct
subsequences of s which equals t.
The test cases are generated so that the answer fits on a 32-bit signed
Input: s = "rabbbit", t = "rabbit"
As shown below, there are 3 ways you can generate "rabbit" from s.
I manage to solve both questions in less time and then I received a Hire Vue
video Interview request. So Hire Vue is the platform with a few leadership-style
questions on the screen and will record a video of our response.
There will be 2 attempts for each question.
Here is some example ( as I don’t remember the exact questions)1. Tell me a situation where you handle the work pressure.
1. What you are looking for from this internship?
2. Tell me the situation where you handle the work pressure.
3. Tell me about a time when you displayed leadership skills.
4. Tell me about a time when you were not satisfied with your performance.
After a few weeks, I got a Technical interview Invite:
2. Technical round:
The interviewer was working in the company for like last 6 months. The round lasted about 1 hour and started with my introduction ( for 10 to 15 minutes ). He started grinding on my resume and throwing the question. Tell me about this project — what you did do and why?
1. How to make asynchronous service in spring boot ( from my resume)
2. Tell me about this project - what you did and why?
3. Difference between asynchronous and synchronous?
4. Many other technical counter questions based on my projects
After 25 minutes he jump to coding, There were 2 coding questions on hackerrank and I have to code them, explain them to him, and run the test cases there
1. You have some number of sticks with positive integer lengths.
These lengths are given as array sticks, where sticks[i] is the length of the ith stick.
You can connect any two sticks of lengths x and y into one stick by paying a cost of x + y.
You must connect all the sticks until there is only one stick remaining.
Return the minimum cost of connecting all the given sticks into one stick in this way.
Input: sticks = [2,4,3]
Explanation: You start with sticks = [2,4,3].
1. Combine sticks 2 and 3 for a cost of 2 + 3 = 5. Now you have sticks = [5,4].
2. Combine sticks 5 and 4 for a cost of 5 + 4 = 9. Now you have sticks = .
There is only one stick left, so you are done. The total cost is 5 + 9 = 14.
Hint : Use Min heap
I explain him using priority queue to make min heap and extract the 2 min element
from the queue every time , merge and insert back
Coded the same and all the test case pass.
2. It was DP hard question ->
You are given several boxes with different colors represented by different
positive numbers. You may experience several rounds to remove boxes until
there is no box left. Each time you can choose some continuous boxes with the same color (i.e.,
composed of k boxes, k >= 1), remove them and get k * k points.
Return the maximum points you can get.
Input: boxes = [1,3,2,2,2,3,4,3,1]
[1, 3, 2, 2, 2, 3, 4, 3, 1]
----> [1, 3, 3, 4, 3, 1] (3*3=9 points)
----> [1, 3, 3, 3, 1] (1*1=1 points)
----> [1, 1] (3*3=9 points)
---->  (2*2=4 points)
Unable to solve the question on time , only 8/15 test case were passed.
DP hard is not my cup of cake and that too in a very limited time. What on earth are they expecting?
Although I know I’m rejected as they are considering only candidates who completed coding completely with the test cases. Source: seniors
Result: Ghosted! After a follow-up with HR, they sent me rejection mail lol ( as expected) !!
Hints from my mistakes:
- Don’t ignore the edge cases and consider them properly.
- Give proper LP answers ( In the STAR method ) as it really has a weightage in interviews.
- Don’t couch for a more straightforward approach when you know it’s wrong !! ( In my case I know it’s a DP question, but I tried using a greedy solution which is obviously wrong, It wasted a lot of time, rather than I would have invested in making a recurrence relation for my DP).
If you like the article please hit that clap button. Unfortunately, more rejection articles coming soon.