# Codenation Interview Experience | On campus for Internship

• Difficulty Level : Hard
• Last Updated : 10 Aug, 2020

I applied for two month long summer(2021) internship at codenation. It was an On-campus internship recruitment (Tier – 2 college).

There were 4 rounds including the online coding round.

Coding round: The test was conducted on hacker rank. It consisted of 3 questions based on DSA. 2 were relatively easier while 1 was a bit tricky. Some students were facing issues compiling

1. Delete k characters from the string consisting of lowercase English alphabets. Among all such possible strings, return the string which is lexicographic ally the largest.
• Similar problem: https://leetcode.com/problems/remove-k-digits/
2. Given two integer arrays, return the minimum number of moves required such that the second array is a sub sequence of the first array. You can insert an element at any index in the first array in one move. Elements in the second array are distinct. Both the arrays can have at most 10^5 elements.
• I solved it by first storing the index of every element of second array in a hashmap. For every element in the first array, if it is also present in the second array, append it’s index in second array(using the hashmap) to another list. The LIS of this list will be the length of maximum elements we can match without performing any operation. The length of 2nd array – LIS was the answer.
3. Given an array of integers and x queries of the form l, r, s, t. The answer to each query is the number of subarrays int he range[l, r], of size s whose bitwise and (&) is greater than t. The array can have at most 10^5 elements and the number of queries were 500.
• Maintaining a prefix sum of the count of all bits from 2^0 to 2^30 and then answering every query using a sliding window approach worked for passing all the test cases.

All those who solved at least 2.5 problems were shortlisted for the next round. 5 of the candidates moved to the next round.

Round 0: It was a project discussion round where you will be asked about your projects and in depth working. If you are well versed with your projects, this is the easiest round to get through. 2 students were rejected in this round. This round took place over call.

Round 1: It was the DSA round where I was asked 2 problems. The interviewer was really dull and non-interactive. He didn’t even read the question and simply just pasted the problem in the shared google doc.  This round took place over google meet and I was asked to write code on the shared google doc. (Platform depends on interviewer too as one of my friend’s interview took place over a zoom call.)

• First problem was, given the following function f, I had to define another function which, given a number n, returns its prime factors along with their powers.

## C++

 `long` `long` `f(``long` `long` `n) {``      ``if``(n == 1 || n is a prime) {``          ``return` `n;``    ``}``      ``else` `{``          ``return` `any of the proper divisors of n;``    ``}``}`

• Second problem was: https://leetcode.com/problems/backspace-string-compare/description/
• I was supposed to solve it in linear time and constant space.

I was able to solve 1st problem completely and the second problem with the help of some hints. I was rejected in this round.

Round 2: Some of my friends who were selected for this round were asked about there projects and then given an open ended problem. This round is for checking the creative thinking skills of the candidate and is usually taken by a senior employee.

Overall, it was a good learning experience interviewing with codenation. Only one of the students were given the final offer for internship. After the online round shortlisting, the entire process took 2-3 days.

My Personal Notes arrow_drop_up