Algorithm/LeetCode
-
[Leetcode] 1598. Crawler Log FolderAlgorithm/LeetCode 2021. 8. 13. 14:41
1598. Crawler Log Folder Easy 31225Add to ListShare The Leetcode file system keeps a log each time some user performs a change folder operation. The operations are described below: "../" : Move to the parent folder of the current folder. (If you are already in the main folder, remain in the same folder). "./" : Remain in the same folder. "x/" : Move to the child folder named x (This folder is gu..
-
[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..
-
[LeetCode] 1641. Count Sorted Vowel Strings #PythonAlgorithm/LeetCode 2021. 5. 13. 15:39
Given an integer n, return the number of strings of length n that consist only of vowels (a, e, i, o, u) and are lexicographically sorted. A string s is lexicographically sorted if for all valid i, s[i] is the same as or comes before s[i+1] in the alphabet. Example 1: Input: n = 1 Output: 5 Explanation: The 5 sorted strings that consist of vowels only are ["a","e","i","o","u"]. Example 2: Input:..