• + 0 comments

    I am very much disappointed with hanker rank, your tool is so incorrect. below is the method run this code. It will pass your all use cases but the code is suppose to be failed it should not pass any use case at all.

    It shows the quality of your tool and teriblle thing is most of the companies RELY ON YOU !! and fails people like in the interview because of your broken tool

    take the case for this array { 5, 1, 2, 3, 7, 8, 6, 4 } it should exit out from the application on first element as 5, if lst[i] - (i + 1) =4 which is greater then 2 but it does not where as it does in local VS studio

    public static void minimumBribes(List<int> lst)
        {
        
    int bribes = 0;
    for (int i = 0; i < lst.Count; i++)
    {
        // Check if the person has moved more than two positions forward
        if (lst[i] - (i + 1) > 2)
        {
            Console.WriteLine("Too chaotic");
            return; // Exit the loop and stop processing
        }
    
        // Count the number of bribes received by the current person
        for (int j = Math.Max(0, lst[i] - 2); j < i; j++)
        {
            if (lst[j] > lst[i])
            {
                bribes++;
            }
        }
    }
    
    
    Console.WriteLine(bribes); 
        }
    
    }