From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/gas_station.cpp | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 other/gas_station.cpp (limited to 'other/gas_station.cpp') diff --git a/other/gas_station.cpp b/other/gas_station.cpp deleted file mode 100644 index 2fdc7fb..0000000 --- a/other/gas_station.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int canCompleteCircuit(vector &gas, vector &cost) { - int n = gas.size(), totalSurplus = 0, surplus = 0, start = 0; - for (int i = 0; i < n; i++) { - totalSurplus += gas[i] - cost[i]; - surplus += gas[i] - cost[i]; - if (surplus < 0) { - surplus = 0; - start = i + 1; - } - } - return (totalSurplus < 0) ? -1 : start; - } -}; - -int main() { - Solution obj; - vector gas1 = {1, 2, 3, 4, 5}, gas2 = {2, 3, 4}, cost1 = {3, 4, 5, 1, 2}, - cost2 = {3, 4, 3}; - cout << obj.canCompleteCircuit(gas1, cost1) << endl; // expect: 3 - cout << obj.canCompleteCircuit(gas2, cost1) << endl; // expect: -1 -} -- cgit v1.2.3