< Summary

Information
Class: LeetCode.Algorithms.IntersectionOfMultipleArrays.IntersectionOfMultipleArraysCounting
Assembly: LeetCode
File(s): D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\IntersectionOfMultipleArrays\IntersectionOfMultipleArraysCounting.cs
Line coverage
100%
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 53
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Intersection(...)100%88100%

File(s)

D:\a\LeetCode-CS\LeetCode-CS\source\LeetCode\Algorithms\IntersectionOfMultipleArrays\IntersectionOfMultipleArraysCounting.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.IntersectionOfMultipleArrays;
 13
 14/// <inheritdoc />
 15public sealed class IntersectionOfMultipleArraysCounting : IIntersectionOfMultipleArrays
 16{
 17    /// <summary>
 18    ///     Time complexity - O(n * m), where n is the number of arrays in nums and m is the length of arrays in nums
 19    ///     Space complexity - O(1)
 20    /// </summary>
 21    /// <param name="nums"></param>
 22    /// <returns></returns>
 23    public IList<int> Intersection(int[][] nums)
 224    {
 225        Span<int> numsFrequencies = stackalloc int[1001];
 26
 1427        for (var i = 0; i < nums.Length; i++)
 528        {
 529            var row = nums[i];
 30
 4831            for (var j = 0; j < row.Length; j++)
 1932            {
 1933                var cell = row[j];
 34
 1935                numsFrequencies[cell]++;
 1936            }
 537        }
 38
 239        var result = new List<int>();
 40
 400841        for (var i = 0; i < numsFrequencies.Length; i++)
 200242        {
 200243            var numsFrequency = numsFrequencies[i];
 44
 200245            if (numsFrequency == nums.Length)
 246            {
 247                result.Add(i);
 248            }
 200249        }
 50
 251        return result;
 252    }
 53}

Methods/Properties

Intersection(System.Int32[][])