Altimetrik interview question

Write a code accomplish accordian functionality