mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 06:51:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input</strong>
|
||||
@@ -27,21 +27,21 @@
|
||||
[null, null, null, -1, null, 3, null, null, null, 5]
|
||||
|
||||
<strong>Explanation</strong>
|
||||
MKAverage obj = new MKAverage(3, 1);
|
||||
<code>MKAverage obj = new MKAverage(3, 1);
|
||||
obj.addElement(3); // current elements are [3]
|
||||
obj.addElement(1); // current elements are [3,1]
|
||||
obj.calculateMKAverage(); // return -1, because m = 3 and only 2 elements exist.
|
||||
obj.addElement(10); // current elements are [3,1,10]
|
||||
obj.calculateMKAverage(); // The last 3 elements are [3,1,10].
|
||||
// After removing smallest and largest 1 element the container will be <code>[3].
|
||||
// After removing smallest and largest 1 element the container will be [3].
|
||||
// The average of [3] equals 3/1 = 3, return 3
|
||||
obj.addElement(5); // current elements are [3,1,10,5]
|
||||
obj.addElement(5); // current elements are [3,1,10,5,5]
|
||||
obj.addElement(5); // current elements are [3,1,10,5,5,5]
|
||||
obj.calculateMKAverage(); // The last 3 elements are [5,5,5].
|
||||
// After removing smallest and largest 1 element the container will be <code>[5].
|
||||
// After removing smallest and largest 1 element the container will be [5].
|
||||
// The average of [5] equals 5/1 = 5, return 5
|
||||
</code></code></pre>
|
||||
</code></pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
Reference in New Issue
Block a user