add scala solution for longest alternating sequence problem