• + 10 comments

    Simple java Solution

    long poisoned = (startID + sweets - 1) % noPrisoners;
    if(poisoned == 0)
    	poisoned = noPrisoners;
    System.out.println(poisoned);