Knorr-Bremse interview question

bit toggling function