Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0eb9a4d

Browse files
committed
Remove task 6
1 parent 71b2a6e commit 0eb9a4d

File tree

1 file changed

+16
-29
lines changed
  • CodingInterview/CodingInterview

1 file changed

+16
-29
lines changed

‎CodingInterview/CodingInterview/Tests.cs

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,6 @@ int[] MoveZeros(int[] arrayOfNumbers)
6767
return listOfElements.ToArray();
6868
}
6969

70-
int GetTrappingRainWater(int[] elevationMap)
71-
{
72-
if (elevationMap == null || elevationMap.Length == 0)
73-
return 0;
74-
int waterToDrop = 0;
75-
int level = 0;
76-
int left = 0;
77-
int right = elevationMap.Length - 1;
78-
while(left < right)
79-
{
80-
int lower = elevationMap[elevationMap[left] < elevationMap[right] ? left++ : right--];
81-
level = Math.Max(lower, level);
82-
waterToDrop += level - lower;
83-
Console.WriteLine($"left{left} right{right} lower {lower} level {level} waterToDrop {waterToDrop}");
84-
}
85-
return waterToDrop;
86-
}
87-
8870
int [] GetProductofArrayExceptSelf(int [] inputArray)
8971
{
9072
if (inputArray == null || inputArray.Length == 0)
@@ -128,6 +110,11 @@ int[] GetMinimumSizeSubarraySum(int[] inputArray, int n)
128110
return null;
129111
}
130112

113+
List<string> GetSummaryRanges(int [] inputArray)
114+
{
115+
return null;
116+
}
117+
131118
[Test]
132119
public void RemoveDuplicatesFromSortedArray_1()
133120
{
@@ -173,17 +160,6 @@ public void MoveZeros_4()
173160
Assert.AreEqual(expectedArrayWithZerosInTheEnd, arrayWithRemoveElement);
174161
}
175162

176-
[Test]
177-
public void TrappingRainWater_6()
178-
{
179-
var elevationMap = new int[] {0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1 };
180-
var expectedValue = 6;
181-
182-
var rainWaterValue = GetTrappingRainWater(elevationMap);
183-
184-
Assert.AreEqual(expectedValue, rainWaterValue);
185-
}
186-
187163
[Test]
188164
public void ProductofArrayExceptSelf_7()
189165
{
@@ -206,5 +182,16 @@ public void MinimumSizeSubarraySum_8()
206182

207183
Assert.AreEqual(expectedArray, outputArray);
208184
}
185+
186+
[Test]
187+
public void SummaryRanges_9()
188+
{
189+
var inputArray = new int[] { 0, 1, 2, 4, 5, 7};
190+
var expectedArray = new string[] { "0->2", "4->5", "7" };
191+
192+
var outputArray = GetSummaryRanges(inputArray);
193+
194+
Assert.AreEqual(expectedArray, outputArray);
195+
}
209196
}
210197
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /