let say number Bottle is 2 and one trial then how many pig we need ?
1 because we are going to feed first bottle to pig 1 if dies then there there is poison in bottle 1 otherwise there is poison in bottle 2.
We can generalize above idea for in binary number.How?
Lets name all bottle from 1 to N .
if in poison bottle I want to know whether in its binary representation first digit is 0 or 1 to do that I will feed pig 1 all bottle in which first digit is one (like 1,3,5,..) if Pig 1 dies then first digit (in binary representation ) is one otherwise 0.
similairy process can be done for other digits
If we have more number of trial than 1 then (lets say 2) we instead of binary number number we can use ternary number.
so this way we will get answer as ceil(log(t+1)(n)); log base t+1 (n)