Skip to content

Commit 24689eb

Browse files
committed
Create README - LeetHub
1 parent 2c29634 commit 24689eb

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

2582-pass-the-pillow/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2><a href="https://leetcode.com/problems/pass-the-pillow">2582. Pass the Pillow</a></h2><h3>Easy</h3><hr><p>There are <code>n</code> people standing in a line labeled from <code>1</code> to <code>n</code>. The first person in the line is holding a pillow initially. Every second, the person holding the pillow passes it to the next person standing in the line. Once the pillow reaches the end of the line, the direction changes, and people continue passing the pillow in the opposite direction.</p>
2+
3+
<ul>
4+
<li>For example, once the pillow reaches the <code>n<sup>th</sup></code> person they pass it to the <code>n - 1<sup>th</sup></code> person, then to the <code>n - 2<sup>th</sup></code> person and so on.</li>
5+
</ul>
6+
7+
<p>Given the two positive integers <code>n</code> and <code>time</code>, return <em>the index of the person holding the pillow after </em><code>time</code><em> seconds</em>.</p>
8+
<p>&nbsp;</p>
9+
<p><strong class="example">Example 1:</strong></p>
10+
11+
<pre>
12+
<strong>Input:</strong> n = 4, time = 5
13+
<strong>Output:</strong> 2
14+
<strong>Explanation:</strong> People pass the pillow in the following way: 1 -&gt; 2 -&gt; 3 -&gt; 4 -&gt; 3 -&gt; 2.
15+
After five seconds, the 2<sup>nd</sup> person is holding the pillow.
16+
</pre>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> n = 3, time = 2
22+
<strong>Output:</strong> 3
23+
<strong>Explanation:</strong> People pass the pillow in the following way: 1 -&gt; 2 -&gt; 3.
24+
After two seconds, the 3<sup>r</sup><sup>d</sup> person is holding the pillow.
25+
</pre>
26+
27+
<p>&nbsp;</p>
28+
<p><strong>Constraints:</strong></p>
29+
30+
<ul>
31+
<li><code>2 &lt;= n &lt;= 1000</code></li>
32+
<li><code>1 &lt;= time &lt;= 1000</code></li>
33+
</ul>

0 commit comments

Comments
 (0)