Citadel Interview Question

Similar to matrix rotation problem