leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1921.cpp (422B)


0 class Solution {
1 public:
2 int eliminateMaximum(const vector<int> &dist, const vector<int> &speed) const {
3 static float time[100001];
4 const int n = dist.size();
6 for (int i = 0; i < n; i++)
7 time[i] = (float)dist[i] / (float)speed[i];
8 sort(begin(time), begin(time) + n);
10 for (int i = 0; i < n; i++)
11 if (time[i] <= i) return i;
12 return n;
13 }
14 };