Algorithms

[LeetCode 1161] Maximum Level Sum of a Binary Tree

Given the root of a binary tree, the level of its root is 1, the level of ...
Algorithms

[LeetCode 996] Number of Squareful Arrays

Given an array A of non-negative integers, the array is squareful if for every pair of adjacent ...
Algorithms

[LeetCode 1557] Minimum Number of Vertices to Reach All Nodes

Given a directed acyclic graph, with n vertices numbered from 0 to n-1, and an array edges where edges[i] = [fromi, toi] represents a directed ...
Arrays

[LeetCode 802] Find Eventual Safe States

We start at some node in a directed graph, and every turn, we ...
Algorithms

[LeetCode 1514] Path with Maximum Probability

You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge ...
Algorithms

[LeetCode 210] Course Schedule II

There are a total of n courses you have to take labelled from 0 to n - 1. ...
Algorithms

[LeetCode 207] Course Schedule

There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1. Some courses ...
Algorithms

[LeetCode 133] Clone Graph

Given a reference of a node in a connected undirected graph. Return a deep copy (clone) of ...
Algorithms

[LeetCode 928] Minimize Malware Spread II

(This problem is the same as Minimize Malware Spread, with the differences bolded.) In ...
Algorithms

[LeetCode 1267] Count Servers that Communicate

You are given a map of a server center, represented as a m * ...