We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 218cab1 commit 502d17cCopy full SHA for 502d17c
CodingInterview/CodingInterview/Tests.cs
@@ -37,6 +37,12 @@ int[] LeaveTwoDuplicates(int[] arrayOfNumbers)
37
return numbersWithTwoDuplicates.ToArray();
38
}
39
40
+ int[] RemoveElement(int[] arrayOfNumbers, int elementToRemove)
41
+ {
42
+ return arrayOfNumbers.Where(element => element != elementToRemove)
43
+ .ToArray();
44
+ }
45
+
46
[Test]
47
public void RemoveDuplicatesFromSortedArray_1()
48
{
@@ -58,5 +64,17 @@ public void RemoveDuplicatesFromSortedArray_2()
58
64
59
65
Assert.AreEqual(expectedSortedArrayWithTwoDuplicates, sortedArrayWithTwoDuplicatesCalculated);
60
66
67
68
+ [Test]
69
+ public void RemoveElement_3()
70
71
+ var arrayWithElements = new int[] { 1, 5, 3, 3, 6, 1, 8, 3, 9, 7 };
72
+ var expectedArrayWithElements = new int[] { 1, 5, 6, 1, 8, 9, 7 };
73
+ var elementToRemove = 3;
74
75
+ var arrayWithRemoveElement = RemoveElement(arrayWithElements, elementToRemove);
76
77
+ Assert.AreEqual(expectedArrayWithElements, arrayWithRemoveElement);
78
61
79
62
80
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments