Rotation with at Most Three Mismatches
Updated
Problem statement
Return whether second can be cyclically rotated so that it differs from first at no more than three positions.
The strings must have equal length. A rotation by zero positions is allowed.
Function
similarAfterRotation(first: String, second: String) → booleanExamples
Example 1
first = "abcde"second = "cdeab"return = trueA cyclic shift produces an exact match.
Example 2
first = "abcdef"second = "xbcyez"return = trueThe zero rotation differs at exactly three positions.
Constraints
0 <= first.length, second.length <= 2000- The strings contain lowercase English letters.
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
- Reliable LLM Call with Independent Retry BudgetsStripe · OAStripe interview questions
- Tennis Game ScoreAbridge · OAAbridge interview questions
- Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
- Robot Assembly Line ConflictsGoogle · OAGoogle interview questions
- Parcel Event TrackingAirbnb · OAAirbnb interview questions
- Repair One Movement InstructionOpenAI · OAOpenAI interview questions
- Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
- Format TextTikTok · OATikTok interview questions
- Binary String Swap TimeMicrosoft · OAMicrosoft interview questions
- Communications HandlerAkuna Capital · OAAkuna Capital interview questions