While typically recommendations are brush your teeth three times a day or after every time you eat, we want to give you more detail to plan better for yourself.
Three factors create cavities:
So this means not only timing is a question, but you can also act on all levels, to reduce the risk of caries and thus cavities.
To reduce the number of agressive bacteria we should keep a good oral hygiene starting as early as possible.
If possible avoid too much sugar and rather eat more raw fruits and vegetables. This of course is not only good for our teeth but also healthy for our whole system.
While it is still true that you should brush after every time you eat something, espeically with sugar in it, this is not always practicable. For once you may not always have a tooth brush and brushing also makes your tooth more sensitive. Again we can act on all levels. We can use a chewing gum, which improves the oral flora and washes away some of the sugar. Mouth wash can be a bit better, then chewing gum. Still we should not wait to long until we brush the next time, but the more we brush the softer we should brush and always after a meal (never before). Finally once a day should do a thorough cleaning including flossing, typically people do this in the evening, so they don't have sugar feeding bakteria in their mouth over night.
Many things we eat are on the side of acid, from fruits, juices to sour sweets. Acid is agressive on the tooth so you should not brush directly after eating something with a high acid level, instead wait 30 Minutes. Rinsing your mouth, e.g. with mouthwash or simply water would help reduce the amount of acid in your mouth.
While there is no timing on how long flossing should take, there seems to be a lower limit on brushing your teeth. Even the brushing timer in MyTeeth is fixed on 3 minutes and can be extended by pausing but not shortened. The reason for this is simple: While for flossing and brushing itself, timing would not be important, the anti bakterial effect of the tooth paste takes time. A minimum of 3 minutes is recommended. For a fluoride gel, even 5 minutes are recommended, to give fluorides time to attach. A good idea is to wait a minute or two before you rinse your mouth after brushing your teeth.