mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	add leetcode problem-cn part1
This commit is contained in:
		@@ -0,0 +1,49 @@
 | 
			
		||||
<p>A bus has <code>n</code> stops numbered from <code>0</code> to <code>n - 1</code> that form a circle. We know the distance between all pairs of neighboring stops where <code>distance[i]</code> is the distance between the stops number <code>i</code> and <code>(i + 1) % n</code>.</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p>The bus goes along both directions i.e. clockwise and counterclockwise.</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p>Return the shortest distance between the given <code>start</code> and <code>destination</code> stops.</p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/09/03/untitled-diagram-1.jpg" style="width: 388px; height: 240px;" /></p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
 | 
			
		||||
<strong>Input:</strong> distance = [1,2,3,4], start = 0, destination = 1
 | 
			
		||||
 | 
			
		||||
<strong>Output:</strong> 1
 | 
			
		||||
 | 
			
		||||
<strong>Explanation:</strong> Distance between 0 and 1 is 1 or 9, minimum is 1.</pre>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 2:</strong></p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/09/03/untitled-diagram-1-1.jpg" style="width: 388px; height: 240px;" /></p>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
 | 
			
		||||
<strong>Input:</strong> distance = [1,2,3,4], start = 0, destination = 2
 | 
			
		||||
 | 
			
		||||
<strong>Output:</strong> 3
 | 
			
		||||
		Reference in New Issue
	
	Block a user