Pair Left and Right Shoes by Size
Updated
Problem statement
A shoe rack contains left shoes and right shoes in various integer sizes. Given the sizes of every left shoe and every right shoe, return whether every shoe can be paired with exactly one opposite-side shoe of the same size.
Function
canPairShoes(leftSizes: int[], rightSizes: int[]) → booleanExamples
Example 1
leftSizes = [7,8,7]rightSizes = [7,7,8]return = trueEvery left shoe has one right shoe of the same size.
Example 2
leftSizes = [6,6]rightSizes = [6,7]return = falseOne left size-6 shoe and the right size-7 shoe remain unmatched.
Constraints
0 <= leftSizes.length, rightSizes.length <= 100000.1 <= size <= 1000000000.
More Motive Phone Screen questions
- Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
- Search in Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2025
- Lowest Common Ancestor in a Binary TreePHONE SCREEN · Seen Apr 2025
- Mark a Queen’s Attack BoardPHONE SCREEN · Seen Feb 2025
- Count Product-Divisible PairsPHONE SCREEN · Seen Sep 2024
- Resolve Variable Equations with Dependency ErrorsPHONE SCREEN · Seen Jun 2024
- Average Values by Binary-Tree LevelPHONE SCREEN · Seen May 2024
- Chunked Round-Robin Row TraversalPHONE SCREEN · Seen May 2024
Similar questions at other companies
- Find Unique ElementsCisco · PHONE SCREENCisco interview questions
- Fixed-Range Frequency CountWaymo · PHONE SCREENWaymo interview questions
- Count Pairs with Absolute Difference KAdobe · PHONE SCREENAdobe interview questions
- Frequency Equals Card ValueInMobi · PHONE SCREENInMobi interview questions
- Do All Frequencies Exceed a Threshold?Google · PHONE SCREENGoogle interview questions
- Apply Operations to Make a String EmptyFlexport · PHONE SCREENFlexport interview questions
- Find Valid SET Card TriplesSnowflake · OA · PHONE SCREENSnowflake interview questions
- Best Poker Category with a JokerScale AI · PHONE SCREEN · ONSITE INTERVIEWScale AI interview questions
- Find All Zip Rummy MeldsZip · PHONE SCREEN · ONSITE INTERVIEWZip interview questions
- Most Common Three-Website SequencesAmazon · PHONE SCREEN