Reported August 2024
Sigtwo pointers

Count Triples

Reported by candidates from Sig's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Sig OA. Under 2s to a working solution.
Founder's read

You've got a Sig OA coming in the next day or two, and "Count Triples" just landed on your radar from someone who sat it in August. The problem sounds simple on the surface, but there's usually a catch in how you count or iterate. This is exactly the kind of problem where you either nail the pattern in 10 minutes or you spin your wheels for 30. StealthCoder sits silently in the background as your insurance policy if you blank on the approach during the real thing.

Pattern and pitfall

Count Triples is almost certainly asking you to find or enumerate triplets (three elements) that satisfy some condition: matching a sum, forming a sequence, meeting a constraint on indices or values. The naive path is a triple nested loop, O(n-cubed), which will time out on large inputs. The real solution usually involves two-pointers after sorting, or a hash table to reduce one loop, bringing it down to O(n-squared) or better. The pitfall: candidates often don't sort first, or they don't realize that tracking pairs and looking up complements is faster than brute force. When you're live and the examples pass but you're not confident on complexity, StealthCoder gives you the clean implementation to lean on.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Count Triples cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder
⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as 3sum. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Sig's OA.

Sig reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Triples FAQ

Is this a two-pointers problem?+

Most likely. After sorting the array, fix one element and use two pointers on the rest. This collapses O(n-cubed) to O(n-squared), which is what Sig expects. Test this pattern first.

What if the sum constraint isn't the condition?+

Read carefully. The condition might be index-based, value-based, or relational (e.g., a < b < c, or a+b > c). The counting logic changes. Hash tables work for non-sorted conditions; sorting + two pointers works for sum-like goals.

How do I avoid duplicates in my count?+

If the OA counts distinct triplets, sort first and skip duplicate values as you iterate. Use a set if you need unordered results, or be careful with index ranges if order matters. Test on the examples.

Can I solve this in under 15 minutes?+

Yes, if you recognize the two-pointers pattern immediately. Sort, fix one element, move two pointers. Write it out, run examples, move on. That's the Sig pace. If you get stuck, pivot to hash table approach.

What languages does Sig usually allow?+

Sig typically supports Python, Java, C++, JavaScript, and Go. Check your invite for specifics. The logic is the same across all; just code in what you're fastest in.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Sig.

OA at Sig?
Invisible during screen share
Get it