Altimetrik Interview Question

Write a code accomplish accordian functionality