Given a number of nodes, how many ways can a graph be drawn?
A network consists of multiple nodes. Each pair of distinct nodes can either be connected by an edge or remain disconnected. A node cannot be connected to itself. Determine the total number of distinct configurations of such a network. Since the result can be very large, return it modulo 10^9 + 7.
Examples
01 · Example 1
n = 3 return = 8
For n = 3 nodes, there are 8 possible configurations:
The function should return 8 because there are 8 possible configurations.
More Snowflake problems
- Horizontal Pod AutoscalerSeen Jun 2026
- Minimum HeightOA · Seen Jun 2026
- Effective Role PrivilegesPHONE SCREEN · Seen May 2026
- Closest Bathroom / Desk on a GridPHONE SCREEN · Seen May 2026
- Minimum Clicks Between Wiki PagesOA · Seen May 2026
- Minimum Index Distance Between Person and CakeOA · Seen May 2026
- Generating Login CodesOA · Seen May 2026
- String Formation (Also for AI/ML Software Engineer Intern :)OA · Seen May 2026
public int drawingEdge(int n) {
// write your code here
}n3
expected8
sign in to submit