Optimal Algorithms for Learning Partitions with Faulty Oracles