Skip to content

Commit 269678d

Browse files
deepesh85bignacio-chiazzo
deepesh85b
authored andcommitted
Update index.js
1 parent 1c76f4b commit 269678d

File tree

1 file changed

+14
-0
lines changed
  • LeetcodeProblems/Algorithms/GasStation

1 file changed

+14
-0
lines changed

LeetcodeProblems/Algorithms/GasStation/index.js

+14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
/**
22
* Problem: https://leetcode.com/problems/gas-station/description/
33
*/
4+
/*
5+
There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].
6+
You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith station to its next (i + 1)th station.
7+
You begin the journey with an empty tank at one of the gas stations.
8+
Given two integer arrays gas and cost, return the starting gas station's index if you can travel around the circuit once in the clockwise direction,
9+
otherwise return -1.
10+
If there exists a solution, it is guaranteed to be unique
11+
12+
Example 1:
13+
14+
Input: gas = [1,2,3,4,5], cost = [3,4,5,1,2]
15+
Output: 3
16+
17+
*/
418
/**
519
* @param {number[]} gas
620
* @param {number[]} cost

0 commit comments

Comments
 (0)