< Summary

Information
Class: LeetCode.Algorithms.CountAndSay.CountAndSayPrecomputed
Assembly: LeetCode
File(s): D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\CountAndSay\CountAndSayPrecomputed.cs
Line coverage
100%
Covered lines: 36
Uncovered lines: 0
Coverable lines: 36
Total lines: 61
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
CountAndSay(...)100%11100%

File(s)

D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\CountAndSay\CountAndSayPrecomputed.cs

#LineLine coverage
 1// --------------------------------------------------------------------------------
 2// Copyright (C) 2025 Eugene Eremeev (also known as Yevhenii Yeriemeieiv).
 3// All Rights Reserved.
 4// --------------------------------------------------------------------------------
 5// This software is the confidential and proprietary information of Eugene Eremeev
 6// (also known as Yevhenii Yeriemeieiv) ("Confidential Information"). You shall not
 7// disclose such Confidential Information and shall use it only in accordance with
 8// the terms of the license agreement you entered into with Eugene Eremeev (also
 9// known as Yevhenii Yeriemeieiv).
 10// --------------------------------------------------------------------------------
 11
 12namespace LeetCode.Algorithms.CountAndSay;
 13
 14/// <inheritdoc />
 15public class CountAndSayPrecomputed : ICountAndSay
 16{
 117    private static readonly string[] Precomputed =
 118    [
 119        "1",
 120        "11",
 121        "21",
 122        "1211",
 123        "111221",
 124        "312211",
 125        "13112221",
 126        "1113213211",
 127        "31131211131221",
 128        "13211311123113112211",
 129        "11131221133112132113212221",
 130        "3113112221232112111312211312113211",
 131        "1321132132111213122112311311222113111221131221",
 132        "11131221131211131231121113112221121321132132211331222113112211",
 133        "311311222113111231131112132112311321322112111312211312111322212311322113212221",
 134        "132113213221133112132113311211131221121321131211132221123113112221131112311332111213211322211312113211",
 135        "111312211312111322212321121113122123211231131122211211131221131112311332211213211321322113311213212312311211131
 136        "311311222113111231133211121312211231131122111213122112132113213221123113112221133112132123222112111312211312111
 137        "132113213221133112132123123112111311222112132113212231121113112221121113122113121113222112132113213221232112111
 138        "111312211312111322212321121113121112131112132112311321322112111312211312112213211231132132211231131122211311123
 139        "311311222113111231133211121312211231131112311211133112111312211213211312111322211231131122211311122122111312211
 140        "132113213221133112132123123112111311222112132113311213211231232112311311222112111312211311123113322112132113213
 141        "111312211312111322212321121113121112131112132112311321322112111312212321121113122112131112131221121321132132211
 142        "311311222113111231133211121312211231131112311211133112111312211213211312111322211231131122111213122112311311222
 143        "132113213221133112132123123112111311222112132113311213211231232112311311222112111312211311123113322112132113212
 144        "111312211312111322212321121113121112131112132112311321322112111312212321121113122112131112131221121321132132211
 145        "311311222113111231133211121312211231131112311211133112111312211213211312111322211231131122111213122112311311222
 146        "132113213221133112132123123112111311222112132113311213211231232112311311222112111312211311123113322112132113212
 147        "111312211312111322212321121113121112131112132112311321322112111312212321121113122112131112131221121321132132211
 148        "311311222113111231133211121312211231131112311211133112111312211213211312111322211231131122111213122112311311222
 149    ];
 50
 51    /// <summary>
 52    ///     Time complexity - O(1)
 53    ///     Space complexity - O(1)
 54    /// </summary>
 55    /// <param name="n"></param>
 56    /// <returns></returns>
 57    public string CountAndSay(int n)
 458    {
 459        return Precomputed[n - 1];
 460    }
 61}

Methods/Properties

.cctor()
CountAndSay(System.Int32)