Question about sort by type

A “building from scratch” structure

A removing from array approach

(baby in my arms, can’t write much)