FastPrepFirst Adjacent Same-Parity Pair
Problems/First Adjacent Same-Parity Pair

First Adjacent Same-Parity Pair

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes scanning adjacent values and finding the first pair that breaks alternating parity. We supplied the rule that the left index is returned, the no-match value, zero-based indexing, and limits. Our version is about 86% the same as the reported question.

Return the zero-based left index of the first adjacent pair whose two values have the same parity. Return -1 when every adjacent pair has opposite parity.

Negative odd values are treated as odd.

Function

firstSameParityPair(values: int[]) → int

Examples

Example 1

values = [1,2,4,5]return = 1

The first same-parity pair begins at index one.

Example 2

values = [1,2,3,4]return = -1

Every adjacent pair has opposite parity.

Constraints

  • 0 <= values.length <= 100000
  • -1000000000 <= values[i] <= 1000000000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Build the Task HierarchyPendo · OA
  • Lowest Number in an Open RangeCapital One · OACapital One interview questions
  • Missing IntervalsIBM · OAIBM interview questions
  • Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Two SumAmazon · OA · PHONE SCREEN
  • Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int firstSameParityPair(int[] values) {
        // Write your code here.
    }

}
Checking account…