PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Walmart Labs

Find Index Pairs of Matching Elements in Arrays

Last updated: Mar 29, 2026

Quick Overview

This question evaluates the ability to work with sorted arrays, index mapping, duplicate handling, and reasoning about correctness and algorithmic complexity.

  • Medium
  • Walmart Labs
  • Coding & Algorithms
  • Data Scientist

Find Index Pairs of Matching Elements in Arrays

Company: Walmart Labs

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

##### Scenario Marketing analytics team needs to find common elements between two sorted arrays of user IDs. ##### Question Given two sorted integer arrays without duplicates, return the list of index pairs where the elements match, e.g., arr1=[1,4,5,6,7,9], arr2=[1,2,3,6,9] -> [[0,0],[3,3],[5,4]]. Follow-ups: Discuss possible edge cases. If the arrays can contain duplicates (arr1=[1,1,4,5,6,6,6,7,9], arr2=[1,2,3,6,6,9,9]), modify your algorithm to return all valid index pairs. ##### Hints Think two-pointer merge approach; handle duplicates with nested loops; analyze O(n+m) time.

Quick Answer: This question evaluates the ability to work with sorted arrays, index mapping, duplicate handling, and reasoning about correctness and algorithmic complexity.

Related Interview Questions

  • Implement lexicographically smallest Two Sum - Walmart Labs (medium)
  • Check whether brackets are balanced - Walmart Labs (medium)
  • Compute days until plants stop dying - Walmart Labs (medium)
  • Count ways to make change (DP) - Walmart Labs (medium)
  • Find shared courses between student pairs - Walmart Labs (medium)
Walmart Labs logo
Walmart Labs
Aug 4, 2025, 10:55 AM
Data Scientist
Onsite
Coding & Algorithms
2
0
Scenario

Marketing analytics team needs to find common elements between two sorted arrays of user IDs.

Question

Given two sorted integer arrays without duplicates, return the list of index pairs where the elements match, e.g., arr1=[1,4,5,6,7,9], arr2=[1,2,3,6,9] -> [[0,0],[3,3],[5,4]].

Follow-ups:

Discuss possible edge cases.

If the arrays can contain duplicates (arr1=[1,1,4,5,6,6,6,7,9], arr2=[1,2,3,6,6,9,9]), modify your algorithm to return all valid index pairs.

Hints

Think two-pointer merge approach; handle duplicates with nested loops; analyze O(n+m) time.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Walmart Labs•More Data Scientist•Walmart Labs Data Scientist•Walmart Labs Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.