< Summary

Information
Class: LeetCode.Algorithms.DesignHashSet.DesignHashSetBoolArray
Assembly: LeetCode
File(s): D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\DesignHashSet\DesignHashSetBoolArray.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 49
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
.ctor()100%11100%
Add(...)100%11100%
Remove(...)100%11100%
Contains(...)100%11100%

File(s)

D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\DesignHashSet\DesignHashSetBoolArray.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.DesignHashSet;
 13
 14/// <inheritdoc />
 15public class DesignHashSetBoolArray : DesignHashSetBase
 16{
 117    private readonly bool[] _items = new bool[ItemsCount];
 18
 19    /// <summary>
 20    ///     Time complexity - O(1)
 21    ///     Space complexity - O(1)
 22    /// </summary>
 23    /// <param name="key"></param>
 24    public override void Add(int key)
 325    {
 326        _items[key] = true;
 327    }
 28
 29    /// <summary>
 30    ///     Time complexity - O(1)
 31    ///     Space complexity - O(1)
 32    /// </summary>
 33    /// <param name="key"></param>
 34    public override void Remove(int key)
 135    {
 136        _items[key] = false;
 137    }
 38
 39    /// <summary>
 40    ///     Time complexity - O(1)
 41    ///     Space complexity - O(1)
 42    /// </summary>
 43    /// <param name="key"></param>
 44    /// <returns></returns>
 45    public override bool Contains(int key)
 446    {
 447        return _items[key];
 448    }
 49}