Reported June 2024
Flexportmath

Maximum Edges

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

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

Flexport sent you a graph problem in June without the full problem text, but the title 'Maximum Edges' is a tell. You're either building a graph structure and finding the maximum number of edges it can hold, or you're counting edges in a constraint-based scenario. The trick is almost always that you're not iterating through all possibilities. StealthCoder will catch the edge case you miss at 2 AM when you blank on the formula. The problem is likely testing whether you know the mathematical ceiling for a complete graph or how to model constraints as edge counts.

Pattern and pitfall

Maximum edges problems hinge on graph theory basics. In a complete undirected graph with n nodes, the max edges is n*(n-1)/2. In a directed graph, it's n*(n-1). The catch: most candidates try to simulate or iterate when the answer is a closed formula. If the problem adds constraints (no self-loops, no duplicate edges, certain nodes unreachable), you're capping the theoretical max. The pattern is usually math or graph modeling, not brute force. When you're under time pressure in the OA, you might overthink the structure instead of spotting that it's asking for a combinatorial count. That's where StealthCoder steps in, showing you the formula and the edge cases in real time so you don't waste 15 minutes on a simulation.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Maximum Edges 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. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Flexport reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Edges FAQ

Is this a simulation problem or a math formula?+

Almost always math. Calculate the theoretical maximum edges for n nodes given the graph type (directed, undirected, weighted, etc.), then apply any stated constraints. Simulation suggests you're on the wrong track. If you're iterating through nodes or edges, reconsider.

What if the problem mentions nodes or connectivity constraints?+

Constraints reduce the max. A disconnected component, a tree, or a bipartite graph all have known max edge formulas. Parse the constraint carefully and adjust your formula. Don't assume a complete graph unless explicitly stated.

Do I need to actually construct the graph?+

No. You're counting, not building. If the problem asks for a count or a maximum, derive it mathematically. Construction is overhead and introduces off-by-one errors.

How do I avoid the common pitfall?+

Test with small examples. For n=3 undirected, max is 3. For n=3 directed, max is 6. Write these down. Most candidates forget the formula or confuse directed and undirected. Verify on paper before coding.

What if the problem is actually asking something else?+

Read twice. 'Maximum' could mean finding the edge count of the largest connected component, or the maximum weight edge, or the max flow. The title is a clue but not the whole story. Check the problem statement carefully.

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

OA at Flexport?
Invisible during screen share
Get it