Remove elements to avoid k-prefix duplicates

Quick Overview

This question evaluates algorithmic design and data-structure proficiency in the Coding & Algorithms domain, focusing on list and sequence manipulation with uniqueness constraints and attention to time complexity. It is commonly asked because it measures practical ability to implement efficient (e.g.

Remove elements to avoid k-prefix duplicates

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

##### Question Given two lists listA and listB and an integer k, delete elements from listB so that the first k elements of the new listB share no value with the first k elements of listA. Follow-up: design an O(n) time solution. Follow-up: extend to a list of lists, an integer k, and an integer d such that for each list its first k elements share no value with the first k elements of any of the previous d lists.

Quick Answer: This question evaluates algorithmic design and data-structure proficiency in the Coding & Algorithms domain, focusing on list and sequence manipulation with uniqueness constraints and attention to time complexity. It is commonly asked because it measures practical ability to implement efficient (e.g.

|Home/Coding & Algorithms/Google
Google logo
Google
Jul 29, 2025, 8:05 AM
mediumSoftware EngineerOnsiteCoding & Algorithms
27
0
Question

Given two lists listA and listB and an integer k, delete elements from listB so that the first k elements of the new listB share no value with the first k elements of listA. Follow-up: design an O(n) time solution. Follow-up: extend to a list of lists, an integer k, and an integer d such that for each list its first k elements share no value with the first k elements of any of the previous d lists.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...