예제 #1
0
        public void AreAnagrams(string super, params string[] others)
        {
            var bigBag = new LetterBag(super);

            foreach (var word in others)
            {
                if (bigBag.TryGetAnagramRemainder(new LetterBag(word), out var remainder))
                {
                    bigBag = remainder;
                }
                else
                {
                    Assert.True(false, $"'{word}' not found in bag.");
                }
            }

            Assert.Equal(0, bigBag.Count);
        }