Sort by

recency

|

1323 Discussions

|

  • + 0 comments

    there is no width array being passed, you can not complete this one

  • + 1 comment

    the problem suck,

    1.you need change the function prototype as; vector serviceLane(vector> cases, vector width) it mean that you need read the main() Legal fuction.

    check from the problme description, you will think that {enter,exit} in the case is the index starting from 1, but acutally you need change it to as starting from 0 then pass.

    • + 0 comments

      Service Lane refers to a designated area in automotive service centers where vehicles are brought in for maintenance, inspection, or repairs. It acts as the first point of contact through website between the customer and the service team. In the service lane, service advisors greet customers, assess vehicle issues, and begin the documentation process before sending the vehicle into the workshop.

  • + 1 comment

    Here is the proper starting point for the Python 3 version of the code. The original did not pass the width array to the serviceLane function.

    Also, the 2d Array Cases uses a 0-based index, not a 1-based index like the example in the prompt.

    HackerRank, please fix the starting code and example for the Python 3 version of this problem!

    import math
    import os
    import random
    import re
    import sys
    
    #
    # Complete the 'serviceLane' function below.
    #
    # The function is expected to return an INTEGER_ARRAY.
    # The function accepts following parameters:
    #  1. INTEGER n
    #  2. INTEGER_ARRAY width
    #  3. 2D_INTEGER_ARRAY cases
    #
    
    def serviceLane(n, width, cases): #changed to add width
        # Write your code here
    
    if __name__ == '__main__':
        fptr = open(os.environ['OUTPUT_PATH'], 'w')
    
        first_multiple_input = input().rstrip().split()
    
        n = int(first_multiple_input[0])
    
        t = int(first_multiple_input[1])
    
        width = list(map(int, input().rstrip().split()))
    
        cases = []
    
        for _ in range(t):
            cases.append(list(map(int, input().rstrip().split())))
    
        result = serviceLane(n, width, cases) #passed width to function
    
        fptr.write('\n'.join(map(str, result)))
        fptr.write('\n')
    
        fptr.close()
    
    • + 0 comments

      At Service Lane, we specialize in creating professional, high-performing websites tailored to meet the unique needs of businesses in Hong Kong. Whether you're a startup seeking a sleek and responsive online presence or an established brand looking to revamp your digital identity, our experienced team delivers custom web design, e-commerce solutions, SEO optimization, and mobile-first development. We combine creativity with cutting-edge technology to ensure your site not only looks website developer hong kong great but also drives traffic, engagement, and conversions. Trust Service Lane to bring your digital vision to life with precision, reliability, and local expertise.

  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/iuLCUdG77yQ You will need to update the serviLane function by adding the width vector, since it was forgotten.

    vector<int> serviceLane(int n, vector<vector<int>> cases, vector<int> width) {
        vector<int> result;
        for(auto cas: cases){
            int r = width[cas[0]];
            for(int i = cas[0]; i <= cas[1]; i++){
                r = min(r, width[i]);
            }
            result.push_back(r);
        }
        return result;
    }
    
  • + 1 comment

    RUST (fixed function)

    fn serviceLane(width: &[i32], cases: &[Vec<i32>]) -> Vec<i32> {
        let mut result: Vec<i32> = Vec::new();
        for case in cases {
            let first_idx = case[0] as usize;
            let second_idx = case[1] as usize;
            if let Some(min_value) = &width[first_idx..=second_idx].iter().min() {
                result.push(**min_value);
            }
        }
        result
    }
    
    • + 1 comment

      A service lane is a designated road or section alongside a main highway or thoroughfare, typically used for vehicles needing access to businesses, parking areas, or for temporary stops without disrupting the main traffic flow. These lanes improve safety and convenience by allowing slower-moving vehicles, delivery trucks, and public transport to pull over without blocking fast-moving traffic. In urban areas, service lanes provide access to residential and commercial buildings, while on highways, they help in emergency situations, vehicle breakdowns, and maintenance work. Efficiently designed service Carpet Cleaning Chemicals lanes contribute to smoother traffic management and enhanced road safety.