Tip 1 : Work on your problem-solving skills. Solve as many questions as you can.
Tip 2 : Communication skills are very important in interviews.
Tip 3 : Do some good projects.
Tip 1 : Mention some good projects on your resume and be prepared.
Tip 2 : Do not put false things on your resume.
This was an elimination round. There were 2 coding questions. Both questions were of medium level and I solved them in a given time. After this round, 29 students got shortlisted and I was one of them.
Let us suppose the numbers are chosen by participants: [2, 6, 5, 2, 3] and K = 3, then the distinct pairs having differences equal to K are: [2, 5] and [3, 6] so print 2.
The list of numbers can contain duplicate numbers, you need to print only the distinct pairs.
For example [2, 2, 3, 4] and K = 1, so you need to print 2 as the two distinct pairs are: (2, 3) and (3, 4).
I solved this question using the map in O(n) time complexity. First I stored the count of elements in an array then by checking the condition(k > 0 && map.containsKey(i + k) || k == 0 && map.get(i) > 1), I incremented the result by one every time when condition satisfied. Below is my code for the same.
class Solution {
public int findPairs(int[] nums, int k) {
Map map = new HashMap();
for(int num : nums)
map.put(num, map.getOrDefault(num, 0) + 1);
int result = 0;
for(int i : map.keySet())
if(k > 0 && map.containsKey(i + k) || k == 0 && map.get(i) > 1)
result++;
return result;
}
}
Let us say A = [2,4,6,7,6,9], then adjacent elements of sub array [6,7,6] have absolute difference of either 0 or 1 and this is the maximum length sub-array. So the required answer will be 3.
This was a simple array problem. I solved this using question as:
Starting from the first element of the array, find the first valid sub-array and store its length then starting from the next element (the first element that wasn’t included in the first sub-array), find another valid sub-array. Repeat the process until all the valid sub-arrays have been found then print the length of the maximum sub-array.
This was a technical round on Zoom. The interviewer was very friendly. He gave me one coding problem. I solved the problem and then he asked to improve time and space complexity if possible. I explained my logic very well. After this question, he asked to me explain 3NF(3rd normal form). Then we had some discussion on OOPs concepts.
1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.
2. put(key, value), Insert the value in the cache if the key is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least recently used item before inserting the new item.
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).
2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.
Solve this beforehand.
This was another technical round. The interviewer gave me a coding problem to solve.
1. Any left parenthesis '(' must have a corresponding right parenthesis ')'.
2. Any right parenthesis ')' must have a corresponding left parenthesis '('.
3. Left parenthesis '(' must go before the corresponding right parenthesis ')'.
4. '*' could be treated as a single right parenthesis ')' or a single left parenthesis '(' or an empty string.
5. An empty string is also valid.
What to do if there are too many requests to a web server? Don’t know if they’re correct. I feel it was a more test to see your critical thinking and acquired knowledge.
What do you want to work in?
Why do you want to join VISA?
Asked what kept them at VISA? And what they’re objectives in their career?
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you create a function in JavaScript?