Category: LeetCode

  • [LeetCode] Graphs

    Types of graphs: Terminologies: 1 Disjoint Set 1.1 Overview of Disjoint Set Q: Given the vertices and edges between them, how could we quickly check whether two vertices are connected? The disjoint set is a data structure(others might refer to it as an algorithm), also known as union-find data structure. The primary use of disjoint…

  • [LeetCode 875] Koko Eating Bananas

    When I first came across this problem, I was stuck. I could not write the solution in 20 minutus. I wondered whether it should be solved by dynamic programming, or whether it should be done by 2D state variable. Or it should be done by greedy algorithm? When I checked out the solution, I found…

  • [LeetCode] The Process of Solving Lonely Pixel I(531) and Lonely Pixel II(533)

    Lonely Pixel I(531) Description Given an m x n picture consisting of black ‘B’ and white ‘W’ pixels, return the number of black lonely pixels.A black lonely pixel is a character ‘B’ that located at a specific position where the same row and same column don’t have any other black pixels. Example 1: Example 2:…

css.php