We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Mathematics
  3. Probability
  4. Zombie March***
  5. Discussions

Zombie March***

Problem
Submissions
Leaderboard
Discussions

Sort 5 Discussions, By:

recency

Please Login in order to post a comment

  • henry_scher_job
    2 years ago+ 0 comments

    I'm pretty sure that this question needs to test edge cases better; I came up with a completely naive algorithm that shouldn't work for low k or a disconnected city, but it passed all tests.

    0|
    Permalink
  • renatosc
    6 years ago+ 1 comment

    The problem states "Every timestep, each zombie RANDOMLY chooses one of its neighboring junctions and walks towards it.", so, how can the solution be always the same?

    1|
    Permalink
  • Dooggy
    9 years ago+ 1 comment

    I can't seem to get my code to run under 2 seconds. Got the right output otherwise. This loop is what's costing me most:

    for (q = 0; q < nb_steps; q++) {
        for (i=0; i<n; i++) {      
            new_numb_zombies[i] = 0;
            for (k = 0; k < nb_adj[i]; k++) {
                w = adj[i][k];
                new_numb_zombies[i] += numb_zombies[w]/nb_adj[w];
            }
        }
        aux = numb_zombies;
        numb_zombies = new_numb_zombies;
        new_numb_zombies = aux;
    }
    

    Any idea on how I could speed this up ?

    0|
    Permalink
  • bicepjai
    9 years ago+ 1 comment

    I tested by downloading a failed input and the test case failed saying "Terminated due to timeout" even before completing the task of forming a graph for me to perform manipulations on it ! Any suggestions ?

    0|
    Permalink
  • WardBeullens
    10 years ago+ 1 comment

    Can we asume zombies can (when they have enough time) traverse the entire city? In other words is the graph representing the city always connected, or can it consist of mutiple components?

    0|
    Permalink

No more comments

Need Help?


View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy