684. Redundant Connection

![https://leetcode.com/problems/redundant-connection/] In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, …, N), with one additional edge added. The added edge has two different vertices chosen from 1 to N, and was not an edge that already existed. The resulting graph is given as a 2D-array of edges. Each element of edges is a pair [u, v] with u < v, that represents an undirected edge connecting nodes u and v. ...

January 16, 2021 · 3 min · volyx

Regions Cut By Slashes

An a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, , or blank space. These characters divide the square into contiguous regions. (Note that backslash characters are escaped, so a \ is represented as “\”.) Return the number of regions. Example 1: Input: [ " /", "/ " ] Output: 2 Explanation: The 2x2 grid is as follows: ...

November 8, 2020 · 6 min · volyx