Official algorithmic problem description and constraints.
After a long and fulfilling career, Chef has decided to retire to a farm out in the countryside.
This farm has several cows and chickens, but Chef doesn't know exactly how many of each there are β he can only see that there are π legs in total across all the animals.
Note that each cow has 4 legs and each chicken has 2 legs, and it is guaranteed that π
N is even.
With π legs in total, what's the minimum possible number of animals that can be present on the farm?
Detailed video explanations, mathematical intuition, and clean C++ implementation code.