Drawing Edge
Reported by candidates from Snowflake's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Snowflake's Drawing Edge showed up in June 2026 reports, and it looks like a graph problem until you read it twice. The catch is the input size: n can be big enough that listing configurations is hopeless, so brute force dies fast. You're counting labeled graphs on n nodes, modulo 10^9 + 7. If your OA is in the next day or two, this one is about spotting the formula, not writing a graph traversal. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the whole answer fits in one line.
The problem
A network has n distinct nodes. Every pair of different nodes can either have one undirected edge or remain disconnected; self-edges are not allowed. Return the number of distinct network configurations modulo 10^9 + 7. Function drawingEdge(n: int) → int Examples Example 1 n = 3 return = 8 For three nodes A, B, and C, the possible edges are AB, AC, and BC. The eight configurations are: no edges only AB only AC only BC AB and AC AB and BC AC and BC all three edges Each of the three edges has two independent states, so there are 2^3 = 8 configurations.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is counting, not graph search. There are n(n-1)/2 possible pairs of distinct nodes, and each pair is independently either an edge or not. So the answer is 2^(n(n-1)/2) mod 10^9 + 7. Example 1 checks out: n = 3 gives 3 pairs, 2^3 = 8. The common pitfall is computing the exponent n(n-1)/2 and then looping or using a naive power, which overflows or times out. Use fast modular exponentiation (square and multiply), and compute the exponent in a wide integer type first. Also watch the n = 0 or n = 1 edge cases, where the exponent is 0 and the answer is 1. Don't reduce the exponent mod 10^9 + 7. If you want to reduce it, use Fermat and mod by 10^9 + 6, since the modulus is prime. StealthCoder is the hedge if the modular power slips your mind live.
Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.
You can drill Drawing Edge 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 StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Snowflake's OA.
Snowflake 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.
Drawing Edge FAQ
What's the trick in Snowflake's Drawing Edge?+
Ignore the graph framing. Each of the n(n-1)/2 possible node pairs is independently present or absent, so the count is 2 raised to that number, taken mod 10^9 + 7. It's pure combinatorics plus fast exponentiation.
How hard is Drawing Edge really?+
Easy once you see the formula, and the example basically hands it to you with 2^3 = 8. The difficulty is only in not overthinking it and in handling a large exponent correctly with modular power.
Do I need DFS or BFS for this?+
No. Nothing is being traversed or connected. You're counting all possible edge subsets of a labeled graph, so no graph traversal, union-find, or DP is needed. A modular pow function is the whole solution.
What pitfalls cause wrong answers here?+
Overflow when computing n(n-1)/2 in a small integer type, looping 2 times the exponent, and forgetting the modulus. Use a 64-bit or big integer for the exponent and binary exponentiation with mod at each multiply.
How do I prepare for this in 48 hours?+
Write modular exponentiation from memory until it's automatic, then practice counting problems where independent binary choices multiply. Know that edges in a simple undirected graph number n(n-1)/2. That covers this question and its close variants.