Skip to content · ⁨Bỏ qua nội dung⁩

Remove duplicates · ⁨Xóa trùng lặp⁩

English

Remove duplicates

Return a new list that keeps each value only once, in the order it first appeared: [1, 1, 2, 3, 3, 1] becomes [1, 2, 3].

A set answers "have I seen this already?" in one fast step. Keep a set of seen values and a list for the result, and only append a value the first time you meet it.

Tiếng Việt

Xóa trùng lặp

Trả về một danh sách mới giữ lại mỗi giá trị chỉ một lần, theo thứ tự nó xuất hiện lần đầu: [1, 1, 2, 3, 3, 1] trở thành [1, 2, 3].

Một set trả lời "Tôi đã thấy cái này chưa?" trong một bước nhanh. Giữ một set các giá trị đã gặp và một danh sách cho kết quả, và chỉ thêm vào một giá trị lần đầu tiên bạn gặp nó.

Log in or create account · ⁨Đăng nhập hoặc tạo tài khoản⁩

IGCSE, A-Level & AP