You are not logged in. Please login at to post your questions!



Sir, why are we taking mod of Particle Count with Max Count+1 as chamber value and then dividing it by Max Count+1... ?

Which algorithm is this ?

asked 04 Oct '12, 16:02

parasmth's gravatar image

accept rate: 0%

If there are A particles, starting from 1 every time you reach Max Count + 1 particles, 1 particle is moved to the consecutive chamber and whole Max Count + 1 particles are destroyed. So, Particles left in the chamber is A % (Max Count + 1) And particles transferred to the next chamber is A / (Max Count + 1) since this will happen again and again starting from 1 to Max Count + 1. See this video it might help you Click


answered 08 Oct '12, 18:06

prakhs123's gravatar image

accept rate: 3%

The solution is basically writing A in the base of n+1. This is because at every n+1 particle the carry is taken over to the the next chamber. Think of this in terms of binary and then you'll be able to apply this for every base n+1. That being said, I'm not able to pass the 3rd test case even though I am 100% sure of my solution (all of them are clearing in 0.00s). Is there anything I should look out for in particular ?


answered 08 Sep '17, 20:53

shivan111's gravatar image

accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 04 Oct '12, 16:02

question was seen: 4,054 times

last updated: 08 Sep '17, 20:53