Detect Overlapping Signature Tabs on Document Pages

Last updated: November 29, 2026

Quick Overview

Each tab placed on an envelope document has a page number and a rectangle (x, y, width, height). Return every pair of tabs on the same page whose rectangles overlap with positive area, so the sender can be warned before sending.

DocuSign
Coding & Algorithms
Software Engineer
DocuSign
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Each tab placed on an envelope document has a page number and a rectangle (x, y, width, height). Return every pair of tabs on the same page whose rectangles overlap with positive area, so the sender can be warned before sending.

In DocuSign eSignature, senders drag signature, initial, date and text tabs onto pages, and overlapping fields create confusing signing experiences. This onsite coding question checks geometric reasoning, a sweep that beats the naive all-pairs check, and careful boundary handling where touching edges are not overlaps.

What the Interviewer Expects
  • Define overlap as strict on both axes, so tabs that only share an edge are fine
  • Partition by page first
  • Sort by left edge and sweep with an active list instead of checking all pairs
  • Return pairs in a canonical order without duplicates
  • Discuss worst-case output size, which can be quadratic regardless of algorithm
Key Topics to Cover
Sweep line
Rectangle intersection
Sorting
Geometry edge cases
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
  • How would you change this to report only tabs overlapping a signature tab specifically?
  • Documents can have thousands of tabs from a bulk template. When does an interval tree or grid hashing beat the sweep?
  • How would you auto-nudge one tab to resolve an overlap?
  • Tab coordinates come in at different page scales. How do you normalise?
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: list of (tab_id, page, x, y, w, h) with y growing downward. Two tabs overlap if a.x < b.x + b.w and b.x < a.x + a.w and the same for y. Strict inequalities mean shared edges are not overlap...

High-Level Design

Group tabs by page. Within a page, sort by left edge. Walk left to right keeping an active list of tabs whose right edge is past the current left edge; anything else can never overlap later tabs becau...


Submit Your Answer
Markdown supported

Related Questions