Square Coding Interview Questions
27 Square coding interview problems with full optimal solutions — 18 easy, 7 medium, 2 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Square interviewer values, and a FAQ section.
Showing 7 problems of 27
- #19mediumfoundational
19. 3Sum
Find every trio of transaction adjustments in a ledger that net to zero — Square's reconciliation engine flags three-way payment splits that cancel out, which can signal money-laundering patterns in its fraud-detection pipeline.
- #20mediumfoundational
20. Group Anagrams
Cluster merchant names that are anagrams of each other so Square's compliance team can batch-review aliases — a hash-map keyed on sorted character signatures groups thousands of merchant strings in a single linear pass.
- #21mediumfoundational
21. Coin Change
Find the minimum number of denominations to make exact change at a Square POS register — this DP problem mirrors the coin-selection logic that Square's hardware team optimizes for cash-drawer accuracy across hundreds of currency configurations.
- #22mediumfoundational
22. Meeting Rooms II
Find how many Square Appointments booking slots overlap simultaneously — Square's scheduling infrastructure uses this interval-heap pattern to compute the minimum number of POS terminals needed to handle concurrent appointment peaks without double-booking.
- #23mediumfoundational
23. Top K Frequent Elements
Surface the K most common payment failure codes from a transaction log — Square's Payments Risk team runs this query at dashboard refresh time to triage which error categories need immediate incident response.
- #24mediumfoundational
24. Product of Array Except Self
Compute each payment terminal's contribution factor without dividing out that terminal's own volume — Square's analytics team uses a no-division prefix-product scan to generate per-merchant weight arrays for settlement-fee allocation without floating-point precision loss.
- #25mediumfoundational
25. Longest Consecutive Sequence
Find the longest unbroken streak of daily transaction IDs in a batch — Square's reconciliation team uses this hash-set scan to detect gaps in sequential invoice numbering that indicate missing or voided payments without sorting the full ledger.