Panda Guru LogoPanda
Guru

Tesco Interview Experience DSA

Round 1: DSA

Questions:

  1. Understanding of the problem statement of the task.
  2. How was it solved?
  3. What was your role and what features did you work on?
  4. There was a heavy focus on testing. What was the code coverage of this project?
  5. What tools were used to identify the code coverage?
  6. How was the PR review process?
  7. How are security bugs handled?
  8. How will you sell your point of view if you come up with a new solution? (Expected answer: using performance benchmarking)
  9. How was the functional correctness of the project ensured when anyone raises a new PR?

DSA Problem:

Candidate's Approach

I proposed a simple merge interval solution that is used to solve the merge intervals problem on LeetCode. My solution was O(n log n) which involved sorting of the intervals. I quickly coded this.

Counter Question: To come up with a solution that took O(n) time.

  • Hint: To use a boolean array.
  • Solution: After a while, I got the hint and created a boolean array and marked the cells as true for whichever ones were part of the shift timings.

Here is the code for the solution:

public static void booleanMergeInterval(int [][] intervals){ boolean [] time = new boolean [25]; List<int []> result = new ArrayList<>(); for(int i = 0; i< intervals.length;i++){ int start = intervals[i][0]; int end = intervals[i][1]; while(start<end){ time[start]=true; start++; } } for(int i = 1; i< 25;i++){ int start = 0; int end = 0; if(time[i]==true){ start= i; while(time[i]==true){ i++; } end = i; result.add(new int []{start,end}); } } for(int [] inter : result){ System.out.println("Intervals are "+inter[0]+" ,"+inter[1]); } }
Interviewer's Feedback

No feedback provided.


Final Questions:

Recommendations for Future Candidates:

  1. Interval problems - commonly seen in interviews.
  2. Merging sorted lists.
  3. K sorted lists.
  4. Sorting Linked Lists.