Leetcode Array And Arraylist In Python How To Sort And Filter