public void PermuteUniqueTests()
        {
            PermutationsII obj = new PermutationsII();
            var            arr = new int[] { 1, 2, 3 };
            var            x   = obj.PermuteUnique(arr);

            arr = new int[] { 1 };
            x   = obj.PermuteUnique(arr);

            arr = new int[] { };
            x   = obj.PermuteUnique(arr);

            arr = new int[] { 1, 1, 2 };
            x   = obj.PermuteUnique(arr);

            arr = new int[] { 1, 1, 2, 3 };
            x   = obj.PermuteUnique(arr);
        }
Example #2
0
        public void Given_array_When_permute_Then_return_2()
        {
            var nums = new int[] { 3, 3, 0, 3 };

            var result = PermutationsII.PermuteUnique(nums);

            foreach (var item in result)
            {
                Console.WriteLine(string.Join(",", item));
            }

            Assert.AreEqual(4, result.Count);
        }