Knorr-Bremse Interview Question

bit toggling function