Round 1 Interview
Hi, everyone In this article I’m sharing my SDE interview experience with Nielson, on 19/04/2024 I went through the interview with Nielsen India for the Mumbai location, they called me on-site for the interview,
I have requested, that I do it online, and they agreed and scheduled an interview hear it went:
Brief interview about my previous work experience,
Then couple of questions about me like, how familiar with Spring Boot, java, cloud deployments etc.
Then the interviewer asked me to solve the question for finding the first non-repeating element in the array (below is how I did, with different approaches and complexity analysis);
Then I asked questions about the company and what they do interviewer explained at a high level after that, the interviewer ended the call, saying that would get back to me;
/*package whatever //do not write package name here */
public class Nielson {
/* ROLE : Software Engineer_Nielson
* Given an array of integers of size N, the task is to find the first non-repeating element in this array.
* arr=[1 ,2, 1, 3, 4]
*
* 0 1 2 3 4 --> 1 --> 0,1 , 2 -->1 , 3 ---> 3, ,4---> 4
*
* approach 1 :
* 1. iterate over the array : ---> calcualte the frequecy map --> should maintain the order
* 2. iterata over the created map --> if( count> 1) , smiply return that elemtn
*
* Time : O(n) + O(n) + O(log(n) ==> O(n)
* Space : O(n)
*
* Map<Integer,Integer> frqhMap=new HashMap<>();
* */
class person {
String name;
Integer age;
}
public static int firstNonRepeating(int[] arr){
/* it maintains the order*/
Map<Integer,Integer> frqhMap=new HashMap<>(); /* cpu intensive */
person[] pAtt= new person[10];
int n=arr.length;
/*iterating over the array and hashify the array with freq O(log(0)*/
for(int i : arr){
frqhMap.put(i, (frqhMap.containsKey(i) ? frqhMap.get(i) : 0) +1 );
}
// System.out.println(frqhMap);
for(int i : arr){
if(frqhMap.get(i)==1) return i;
}
return -1;
}
}
result :
i'm not selected for the job
Top comments (0)