# Domino And Tromino Tiling

• The solution is actually for the Digits Rotation problem. Please correct.

• Hi @Awice, my solution can run in LOGN, could you add my solution to this editorial?
I used Matrix multiplication
https://leetcode.com/problems/domino-and-tromino-tiling/discuss/116546/Using-recurrence-Log(N)-very-Quick-LOG(N)-in-java-can-run-with-N-1000000000

• @ngoc_lam Added it with my style - thanks

• @awice Ok, that is great. I just want to introduce leetcode user with better solution.

• @ngoc_lam Great solution!

• I've made a simple schema to explain visually the transition steps, it helped me to understand.

• @snailandmail Haha, thank you :)). Your comment made me so happy

• Hi, @awice, thank you for the solution, but I still can't understand solution 1. For example, if N = 2, then the final dp will be {2,2,2,3}, why do we return dp[0x00], and what does the other three numbers mean?

• Isn't the Approach #2 in Space Complexity: O(log N) due to the space of recursion stack?

• @skw_kevin good catch, updated it

• @awice Q1. why are you returning dp[0]? should not be dp[3], as last row should be completely filled.
Q2. ndp[3] can transit from dp[3] + vertical domino. why this case is not considered?

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.