• + 0 comments

    C++ Solution: Need to add width as parameter input.

    vector<int> serviceLane(int n, vector<int> width, vector<vector<int>> cases) {
        int N = cases.size();
        vector<int> results;
        for(int i = 0; i < N; i++)
        {
            int min_width = INT8_MAX;
            for(int j = cases[i][0]; j <= cases[i][1]; j++)
            {
                min_width = min(width[j], min_width);
            }
            results.push_back(min_width);
        }
        return results;
    }