< Summary

Information
Class: LeetCode.Algorithms.ConstructTheMinimumBitwiseArray1.ConstructTheMinimumBitwiseArray1Dictionary
Assembly: LeetCode
File(s): D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\ConstructTheMinimumBitwiseArray1\ConstructTheMinimumBitwiseArray1Dictionary.cs
Line coverage
100%
Covered lines: 180
Uncovered lines: 0
Coverable lines: 180
Total lines: 208
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\ConstructTheMinimumBitwiseArray1\ConstructTheMinimumBitwiseArray1Dictionary.cs

#LineLine coverage
 1// --------------------------------------------------------------------------------
 2// Copyright (C) 2026 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.ConstructTheMinimumBitwiseArray1;
 13
 14/// <inheritdoc />
 15public sealed class ConstructTheMinimumBitwiseArray1Dictionary : IConstructTheMinimumBitwiseArray1
 16{
 117    private static readonly Dictionary<int, int> NumToValueDictionary = new()
 118    {
 119        { 2, -1 },
 120        { 3, 1 },
 121        { 5, 4 },
 122        { 7, 3 },
 123        { 11, 9 },
 124        { 13, 12 },
 125        { 17, 16 },
 126        { 19, 17 },
 127        { 23, 19 },
 128        { 29, 28 },
 129        { 31, 15 },
 130        { 37, 36 },
 131        { 41, 40 },
 132        { 43, 41 },
 133        { 47, 39 },
 134        { 53, 52 },
 135        { 59, 57 },
 136        { 61, 60 },
 137        { 67, 65 },
 138        { 71, 67 },
 139        { 73, 72 },
 140        { 79, 71 },
 141        { 83, 82 },
 142        { 89, 88 },
 143        { 97, 96 },
 144        { 101, 100 },
 145        { 103, 101 },
 146        { 107, 105 },
 147        { 109, 108 },
 148        { 113, 112 },
 149        { 127, 63 },
 150        { 131, 129 },
 151        { 137, 136 },
 152        { 139, 137 },
 153        { 149, 148 },
 154        { 151, 149 },
 155        { 157, 156 },
 156        { 163, 161 },
 157        { 167, 165 },
 158        { 173, 172 },
 159        { 179, 176 },
 160        { 181, 180 },
 161        { 191, 159 },
 162        { 193, 192 },
 163        { 197, 196 },
 164        { 199, 197 },
 165        { 211, 209 },
 166        { 223, 207 },
 167        { 227, 225 },
 168        { 229, 228 },
 169        { 233, 232 },
 170        { 239, 231 },
 171        { 241, 240 },
 172        { 251, 247 },
 173        { 257, 256 },
 174        { 263, 259 },
 175        { 269, 268 },
 176        { 271, 263 },
 177        { 277, 276 },
 178        { 281, 280 },
 179        { 283, 279 },
 180        { 293, 292 },
 181        { 307, 303 },
 182        { 311, 309 },
 183        { 313, 312 },
 184        { 317, 316 },
 185        { 331, 327 },
 186        { 337, 336 },
 187        { 347, 343 },
 188        { 349, 348 },
 189        { 353, 352 },
 190        { 359, 351 },
 191        { 367, 365 },
 192        { 373, 372 },
 193        { 379, 375 },
 194        { 383, 319 },
 195        { 389, 388 },
 196        { 397, 396 },
 197        { 401, 400 },
 198        { 409, 408 },
 199        { 419, 417 },
 1100        { 421, 420 },
 1101        { 431, 423 },
 1102        { 433, 432 },
 1103        { 439, 431 },
 1104        { 443, 441 },
 1105        { 449, 448 },
 1106        { 457, 456 },
 1107        { 461, 460 },
 1108        { 463, 455 },
 1109        { 467, 466 },
 1110        { 479, 463 },
 1111        { 487, 479 },
 1112        { 491, 489 },
 1113        { 499, 497 },
 1114        { 503, 501 },
 1115        { 509, 508 },
 1116        { 521, 520 },
 1117        { 523, 521 },
 1118        { 541, 540 },
 1119        { 547, 545 },
 1120        { 557, 556 },
 1121        { 563, 561 },
 1122        { 569, 568 },
 1123        { 571, 563 },
 1124        { 577, 576 },
 1125        { 587, 583 },
 1126        { 593, 592 },
 1127        { 599, 591 },
 1128        { 601, 600 },
 1129        { 607, 603 },
 1130        { 613, 612 },
 1131        { 617, 616 },
 1132        { 619, 611 },
 1133        { 631, 623 },
 1134        { 641, 640 },
 1135        { 643, 639 },
 1136        { 647, 645 },
 1137        { 653, 652 },
 1138        { 659, 655 },
 1139        { 661, 660 },
 1140        { 673, 672 },
 1141        { 677, 676 },
 1142        { 683, 679 },
 1143        { 691, 688 },
 1144        { 701, 700 },
 1145        { 709, 708 },
 1146        { 719, 703 },
 1147        { 727, 711 },
 1148        { 733, 732 },
 1149        { 739, 735 },
 1150        { 743, 739 },
 1151        { 751, 749 },
 1152        { 757, 756 },
 1153        { 761, 760 },
 1154        { 769, 768 },
 1155        { 773, 772 },
 1156        { 787, 779 },
 1157        { 797, 796 },
 1158        { 809, 808 },
 1159        { 811, 809 },
 1160        { 821, 820 },
 1161        { 823, 815 },
 1162        { 827, 825 },
 1163        { 829, 828 },
 1164        { 839, 831 },
 1165        { 853, 852 },
 1166        { 857, 856 },
 1167        { 859, 851 },
 1168        { 863, 861 },
 1169        { 877, 876 },
 1170        { 881, 880 },
 1171        { 883, 875 },
 1172        { 887, 885 },
 1173        { 907, 899 },
 1174        { 911, 909 },
 1175        { 919, 903 },
 1176        { 929, 928 },
 1177        { 937, 936 },
 1178        { 941, 940 },
 1179        { 947, 939 },
 1180        { 953, 952 },
 1181        { 967, 959 },
 1182        { 971, 969 },
 1183        { 977, 976 },
 1184        { 983, 975 },
 1185        { 991, 959 },
 1186        { 997, 996 }
 1187    };
 188
 189    /// <summary>
 190    ///     Time complexity - O(n)
 191    ///     Space complexity - O(1)
 192    /// </summary>
 193    /// <param name="nums"></param>
 194    /// <returns></returns>
 195    public int[] MinBitwiseArray(IList<int> nums)
 2196    {
 2197        var n = nums.Count;
 198
 2199        var result = new int[n];
 200
 18201        for (var i = 0; i < n; i++)
 7202        {
 7203            result[i] = NumToValueDictionary[nums[i]];
 7204        }
 205
 2206        return result;
 2207    }
 208}