PREPARATION TIP:
Tip1- Don’t create panic in any case in the interview , as even if you are not selected you will learn a lot from your interview experience and perform well in the future.
Tip2- Also I would recommend you Coding Ninjas as according to me it is a good platform to learn basic coding concepts and to practice coding.
Tip 1: Write whatever you are sure about and have actually done that.
Tip 2: CGPA plays a good role but not a complete role as it is just eligibility criteria for some companies. Have at least 1 or 2 good projects from which you know everything involved in the project.
- Morning time
- Environment was good.
- No
- Interviewer was good



Input: 'n' = 7, 'x' = 3
'arr' = [1, 1, 1, 2, 2, 3, 3]
Output: 2
Explanation: Total occurrences of '3' in the array 'arr' is 2.
s1- Count number of occurrences (or frequency) in a sorted array
s2- Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[].
s3- Examples:
Input: arr[] = {1, 1, 2, 2, 2, 2, 3,}, x = 2
Output: 4
2 occurs 4 times in arr[]



Input: 'arr' = [1, 2, 7, -4, 3, 2, -10, 9, 1]
Output: 11
Explanation: The subarray yielding the maximum sum is [1, 2, 7, -4, 3, 2].
s1- My Approach
s2- Given an array and an integer K, find the maximum for each and every contiguous subarray of size k.
Examples :
Input: arr[] = {1, 2, 3, 1, 4, 5, 2, 3, 6}, K = 3
Output: 3 3 4 5 5 5 6
Explanation:
Maximum of 1, 2, 3 is 3
Maximum of 2, 3, 1 is 3
Maximum of 3, 1, 4 is 4
Maximum of 1, 4, 5 is 5
Maximum of 4, 5, 2 is5
Maximum of 5, 2, 3 is 5
Maximum of 2, 3, 6 is 6
- Morning time
- Environment was good.
- No
- Interviewer was good



As this value might be large, print it modulo 10^9 + 7
s1- For this question, I simply used some mathematics and considered the frequency of each element and their contribution to subsequences.
s2- Wrote its fully commented code with neat handwriting.



1. Delete a character
2. Replace a character with another one
3. Insert a character
Strings don't contain spaces in between.
s1- Firstly I gave the interviewer, a recursive solution then he asked me to reduce complexity as it was exponential of recursive solution so I gave him a top-down DP solution.
- Morning time
- Environment was good.
- No
- Interviewer was good



Conditions for valid parentheses:
1. All open brackets must be closed by the closing brackets.
2. Open brackets must be closed in the correct order.
()()()() is a valid parentheses.
)()()( is not a valid parentheses.
s1. You don't need to print anything, it has already been taken care of. Just implement the given function.
s2. You can return strings in any order.



If a string has 'x' repeated 5 times, replace this "xxxxx" with "x5".
The string is compressed only when the repeated character count is more than 1.
Consecutive count of every character in the input string is less than or equal to 9. You are not required to print anything. It has already been taken care of. Just implement the given function and return the compressed string.
s1- This can be solved using maps or by taking extra array(storing frequencies).

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?