GoLang Solution For LeetCode Problem: Pyramid Transition Matrix
We are stacking blocks to form a pyramid. Each block has a color which is a one letter string.
Return true if we can build the pyramid all the way to the top, otherwise false.
Input: bottom = "BCD", allowed = ["BCG", "CDE", "GEA", "FFF"] Output: true Explanation: We can stack the pyramid like this: A / \ G E / \ / \ B C D We are allowed to place G on top of B and C because BCG is an allowed triple. Similarly, we can place E on top of C and D, then A on top of G and E.
Input: bottom = "AABA", allowed = ["AAA", "AAB", "ABA", "ABB", "BAC"] Output: false Explanation: We can't stack the pyramid to the top. Note that there could be allowed triples (A, B, C) and (A, B, D) with C != D.
See the full details of the problem Pyramid Transition Matrix at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go