FastPrepDetect Cross-Doctor Prescription Pairs Within 30 Days
Problems/Detect Cross-Doctor Prescription Pairs Within 30 Days

Detect Cross-Doctor Prescription Pairs Within 30 Days

Oracle logoOracle● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Oracle onsite interview. The report gives the main task and the interview setting. We rebuilt the function signature, a fixed order for the output, the examples, and the input limits to stay close to the report. We think our version is about 90% the same as the reported question.

Each date-sorted record is [patientId, doctorId, drugName, YYYY-MM-DD].

Return every distinct patientId + " " + drugName pair for which two different doctors prescribed that drug to that patient within at most 30 days of each other. Emit a pair once, when it first qualifies in input order. Dates are valid ISO calendar dates.

Function

findCrossDoctorPrescriptions(records: String[][]) → String[]

Examples

Example 1

records = [["P1","D1","Atorvastatin","2025-01-10"],["P1","D2","Atorvastatin","2025-02-05"],["P2","D3","Metformin","2025-03-01"],["P2","D4","Metformin","2025-03-25"]]return = ["P1 Atorvastatin","P2 Metformin"]

Both patient-drug pairs have different doctors within 30 days.

Example 2

records = [["P1","D1","A","2025-01-01"],["P1","D2","A","2025-02-01"]]return = []

The records are 31 days apart, so the pair does not qualify.

Example 3

records = []return = []

No records produce no pairs.

Constraints

  • 0 <= records.length <= 100000.
  • Records are sorted by nondecreasing date.
  • Identifiers and drug names are nonempty and contain no spaces.

More Oracle Onsite Interview questions

  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Minimum Meeting RoomsONSITE INTERVIEW · Seen Nov 2026
  • Shortest Window with Required CountsONSITE INTERVIEW · Seen Nov 2026
  • Maximum Subarray Sum with One DeletionONSITE INTERVIEW · Seen Nov 2026
  • Shortest Deletion for Distinct CharactersONSITE INTERVIEW · Seen Nov 2026
  • Count Dropped Rate-Limited RequestsONSITE INTERVIEW · Seen Nov 2026
  • Design Authentication ManagerONSITE INTERVIEW · Seen Oct 2026
  • Maximum Bouquet ValueONSITE INTERVIEW · Seen Oct 2026
  • Cache an Expensive Service Across ThreadsONSITE INTERVIEW · Seen Oct 2026
  • Island Count and Maximum AreaONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Find Word-Multiset WindowsAmazon · PHONE SCREEN
  • Incident MonitorStripe · OAStripe interview questions
  • Shortest Uncommon SubstringAirbnb · ONSITE INTERVIEWAirbnb interview questions
  • Longest Substring Without Repeating CharactersSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Longest Substring Without Repeating CharactersMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Longest Substring Without Repeating CharactersGoogle · ONSITE INTERVIEWGoogle interview questions
  • Word BreakMoveworks · ONSITE INTERVIEWMoveworks interview questions
  • Count Equal Code Pairs Within Distance KInfosys · ONSITE INTERVIEWInfosys interview questions
  • Invalid TransactionsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions

Oracle interview experiences

  • Oracle SWE Onsite Interview Experience: 1 Experience
All Oracle interview questionsSee Oracle hiring insights
Saved
class Solution {
    public String[] findCrossDoctorPrescriptions(String[][] records) {
        // write your code here
    }
}
Checking account…