BAE Systems Interview Question

Writing pseudo-code.