# 1mg Interview Experience (Off Campus)

• Difficulty Level : Hard
• Last Updated : 30 Jul, 2019

I was interviewed for Software Developer Profile at 1mg, gurugram.

Round 1: Online Test

• Given an array of numbers, arrange them in a way that yields the largest value.
For example, if the given numbers are {54, 546, 548, 60}, the arrangement 6054854654 gives the largest value. And if the given numbers are {1, 34, 3, 98, 9, 76, 45, 4}, then the arrangement 998764543431 gives the largest value.
• We have to find the count of Longest increasing subsequence (LIS) for each change we made at ith position in array from 1 to n, i.e 1<=a[i]<=n.
– Input:
3 1               // n  i
1 2 3
– Output:
2         //LIS of  1 1 3    put a[i]=1
3        // LIS of  1 2 3     put a[i]=2
2        //LIS of  1 3 3     put a[i]=3
– Time Complexity Required: O(nlogn)+O(n)

Round 2:

• Tell me about yourself.
• Current project in the current organization
– REST VS SOAP
– HTTP Methods of REST
– Write a REST service to search a particular data in Database in current project.
• Design an Authentication system (with only email ans password)(with flow and Database Schema).
• Design a Third party Authentication system via Facebook(with flow and Database Schema).

Round 3:

• Discussion on College Project based on Machine learning ( explain KNN- classifier )
• Find the minimum element in a sorted and rotated array
Input: {5, 6, 1, 2, 3, 4}
Output: 1

• To find maximum length substring in an input string which could be arranged into a palindrome, only even length palindromes are expected. Input is one line String which contains only integers.
The output is the length of the substring which could be arranged in palindrome.
Input: `124565463`
Output: `6` (substring `456546` can be rearranged to an even palindrome)
• In 1D number line system (-Infinity, +Infinity), at beginning a car with velocity(V)=+1 at position(pos)=0 (origin), with every Acceleration(A) it jumps twice of its current velocity(in +ve or -ve direction) and with every Reverse(R) it’s position remain same but velocity changes to -1 if its was +ve or +1 if it was -ve.
You have to find the count of shortest string (combination of A’s and R’s) to reach from origin to +N
Input: `+6`
Output: `5` (substring `AAARA` )
Explanation:  pos      V
Initial :           0        +1
after A:         +1        +2
after A:         +3       +4
after A:         +7        +8
after R:         +7         -1
after A:         `+6`        -2
• Implement rand3() using rand2()

• Implement rand5() using rand2()

Round 4:

Round 5: VP round

• Tell me about yourself.
• Current project in the current organization
– What was the toughest challenge you faced in a project?
• Why do you want to leave current organisation
• Print characters and their frequencies( special characters can be present).
Input : str = “\$characters\$”
Output : \$2 c2 h1 a2 r2 t1 e1 s1
Hint: Hash, AVL

Got Offer but declined as I had better option, not in terms of money but in tech. stack

My Personal Notes arrow_drop_up