Movatterモバイル変換


[0]ホーム

URL:


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

Commited7e540

Browse files
refactor 1184
1 parentfa29e41 commited7e540

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

‎src/main/java/com/fishercoder/solutions/_1184.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,5 @@
11
packagecom.fishercoder.solutions;
22

3-
/**
4-
* 1184. Distance Between Bus Stops
5-
*
6-
* A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n.
7-
* The bus goes along both directions i.e. clockwise and counterclockwise.
8-
* Return the shortest distance between the given start and destination stops.
9-
*
10-
* Example 1:
11-
* Input: distance = [1,2,3,4], start = 0, destination = 1
12-
* Output: 1
13-
* Explanation: Distance between 0 and 1 is 1 or 9, minimum is 1.
14-
*
15-
* Example 2:
16-
* Input: distance = [1,2,3,4], start = 0, destination = 2
17-
* Output: 3
18-
* Explanation: Distance between 0 and 2 is 3 or 7, minimum is 3.
19-
*
20-
* Example 3:
21-
* Input: distance = [1,2,3,4], start = 0, destination = 3
22-
* Output: 4
23-
* Explanation: Distance between 0 and 3 is 6 or 4, minimum is 4.
24-
*
25-
* Constraints:
26-
* 1 <= n <= 10^4
27-
* distance.length == n
28-
* 0 <= start, destination < n
29-
* 0 <= distance[i] <= 10^4
30-
* */
313
publicclass_1184 {
324
publicstaticclassSolution1 {
335
publicintdistanceBetweenBusStops(int[]distance,intstart,intdestination) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp