Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add `mins` and `maxes` TypeScript goodies

Đang mở
#178 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu bằng cách tìm Iterator.prototype.min và Iterator.prototype.max, sau đó đọc các tiện ích BinaryHeap và compareNatural. Hãy xem xét các tên được đề xuất là Iterator.prototype.mins và Iterator.prototype.maxes, cũng như cách comparator sẽ được xử lý cho từng tên. Được coi là hoàn tất khi cả hai tiện ích được đề xuất đều hoạt động với nhiều giá trị nhỏ nhất hoặc lớn nhất; hành vi của NaN có thể vẫn nằm ngoài phạm vi ban đầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement typescript

The Ruby min and max methods allow specifying an argument, to get more than one minimum or maximum. I think it'd be fun to add a goody for this, but rather than modifying Iterator.prototype.min and/or Iterator.prototype.max, I think we should have new goodies for this, since it's a somewhat niche need.

I'm proposing Iterator.prototype.mins and Iterator.prototype.maxes as the names for these, although other suggestions are welcome.

For the implementation, BinaryHeap would be fun to use. It will be easiest to start with .maxes (since the default behavior of the heap is as a min-heap, and we can use compareNatural goody as the default comparator). For .mins, it will be necessary to come up with a way to reverse the comparator.

Additional note: min and max handle NaN specially. We can skip that behavior to start with for .mins and .maxes, and come back to it later.

Ngôn ngữ chính
TypeScript
Star
20
Fork
12
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của code-chronicles-code/leetcode-curriculum

Tất cả issue của code-chronicles-code/leetcode-curriculum

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.