SAP interview question

Code refactorings and factorial optimization