Flag Repeat Claim Lines Billed Within a Thirty Day Window

Last updated: November 29, 2026

Quick Overview

Given claim lines as (claim_id, member_id, procedure_code, service_date), return the IDs of lines whose member and procedure code were already billed within the previous 30 days. Process lines in service-date order.

Cognizant
Coding & Algorithms
Software Engineer
Cognizant
November 29, 2026
Software Engineer
Online Assessment
Coding & Algorithms
Easy

0

0

0 solved


Given claim lines as (claim_id, member_id, procedure_code, service_date), return the IDs of lines whose member and procedure code were already billed within the previous 30 days. Process lines in service-date order.

Cognizant supports healthcare payers through TriZetto platforms such as Facets and QNXT, where duplicate billing is a constant cost leak. An entry-level online assessment question in this style checks that you can pick the right key for a hash map, sort by date, and handle date arithmetic without off-by-one mistakes.

What the Interviewer Expects
  • Sorts by service date before scanning
  • Uses (member_id, procedure_code) as a composite key
  • Parses dates properly instead of comparing strings arithmetically
  • States whether the window is inclusive and keeps it consistent
  • Runs in O(n log n) with O(n) extra space
Key Topics to Cover
hash maps
sorting
date arithmetic
claims processing
duplicate detection
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Should the window compare against the first claim in a cluster or the most recent one? How does the answer change the code?
  • How would you also catch claims with the same procedure code but a different modifier that pays the same?
  • The file has 50 million lines and does not fit in memory. How do you process it?
  • How would you report the original claim each duplicate matched against?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input is a list of claim lines; each has claim_id, member_id, procedure_code and an ISO service_date. A line is a repeat if the same member had the same procedure code billed on a date at most...

High-Level Design

Sort lines by (service_date, claim_id) so the scan sees history in time order and ties are deterministic. Keep a dict from (member, code) to the most recent service date seen. For each line, look ...


Submit Your Answer
Markdown supported

Related Questions