전체 글
-
[LeetCode] 1791. Find Center of Star GraphAlgorithm/LeetCode 2021. 8. 13. 10:03
There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node. You are given a 2D integer array edges where each edges[i] = [ui, vi] indicates that there is an edge between the nodes ui and vi. Return the center of the given star graph. Example 1: Input..
-
[Leetcode] 565. Array Nesting array nestingAlgorithm/LeetCode 2021. 8. 12. 13:55
tags: LeetCode Algorithm Python A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], ... } subjected to the rule below. Suppose the first element in S starts with the selection of element A[i] of index = i, the next element in S should be A[A[i]], and then A[A[A[i]]]… By that analogy, we stop..
-
-