Solution using a lookup table…


  • 0
    I

    JavaScript:

    var countArrangement = function(N) {
        return [1,1,2,3,8,10,36,41,132,250,700,750,4010,4237,10680,24679][N];
    };
    

    C#:

    public class Solution {
        public int CountArrangement(int N) {
            return new int[]{1,1,2,3,8,10,36,41,132,250,700,750,4010,4237,10680,24679}[N];
        }
    }
    

    The test case set is limited, so just click “Run code” and find answers to all possible cases.


Log in to reply
 

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