PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/DRW

Solve odd-string, digit swap, patient slot assignment

Last updated: Mar 29, 2026

Quick Overview

This multi-part problem evaluates string manipulation and parity/combinatorics for constructing odd-occurrence strings, greedy optimization and minimal-change reasoning for digit-swap distance minimization, and bipartite matching/assignment skills for patient slot allocation.

  • Medium
  • DRW
  • Coding & Algorithms
  • Software Engineer

Solve odd-string, digit swap, patient slot assignment

Company: DRW

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

##### Question Task 1 – Odd-occurrence string: Write a function that, given an integer N (1..200 000), returns a length-N lowercase string in which every letter that appears occurs an odd number of times. ​ Task 2 – Min-swap closest numbers: Write a function solution(string S, string T) that, given two digit strings S and T of equal length N (1..100 000) with no leading zeros, returns the minimum number of position-wise digit swaps needed to minimize |int(S) – int(T)|. ​ Task 3 – Patient slot assignment: Write a function solution(int[] A, int[] B, int S) that, given two arrays A and B of length N (1..100 000) containing preferred doctor-appointment slots (1..S, where S ≤ 100 000) for each patient, returns true if all patients can be assigned one of their two preferred slots with no slot shared by more than one patient, otherwise false.

Quick Answer: This multi-part problem evaluates string manipulation and parity/combinatorics for constructing odd-occurrence strings, greedy optimization and minimal-change reasoning for digit-swap distance minimization, and bipartite matching/assignment skills for patient slot allocation.

Related Interview Questions

  • Solve three algorithmic OA problems - DRW (medium)
  • Compute rolling standard deviation in O(n) - DRW (Medium)
  • Solve movie ratings, array, release scheduler - DRW (Medium)
  • Implement portfolio optimization simulation - DRW (Medium)
  • Solve three algorithmic OA tasks - DRW (Medium)
DRW logo
DRW
Aug 4, 2025, 10:55 AM
Software Engineer
Take-home Project
Coding & Algorithms
2
0
Question

Task 1 – Odd-occurrence string: Write a function that, given an integer N (1..200 000), returns a length-N lowercase string in which every letter that appears occurs an odd number of times.

​

Task 2 – Min-swap closest numbers: Write a function solution(string S, string T) that, given two digit strings S and T of equal length N (1..100 000) with no leading zeros, returns the minimum number of position-wise digit swaps needed to minimize |int(S) – int(T)|.

​

Task 3 – Patient slot assignment: Write a function solution(int[] A, int[] B, int S) that, given two arrays A and B of length N (1..100 000) containing preferred doctor-appointment slots (1..S, where S ≤ 100 000) for each patient, returns true if all patients can be assigned one of their two preferred slots with no slot shared by more than one patient, otherwise false.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More DRW•More Software Engineer•DRW Software Engineer•DRW Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,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.