Implement laptop allocation
まだ誰も着手していません。
評価
調査の方向性
まず、候補となるラップトップを見つけるための以前の準備課題を確認し、次に、示されている Person、Laptop、OperatingSystem の定義を allocate_laptops のエントリーポイントとして使用します。すべての人がちょうど1台のラップトップを持ち、悲しみの合計が最小化され、一覧にないオペレーティングシステムは100として数えられれば完了です。
索引モデルが issue の本文から書いたものです。
説明
In the prep, there was an exercise around finding possible laptops for a group of people.
Your exercise is to extend this to actually allocate laptops to the people.
Given these class definitions:
from dataclasses import dataclass
from enum import Enum
from typing import List
class OperatingSystem(Enum):
MACOS = "macOS"
ARCH = "Arch Linux"
UBUNTU = "Ubuntu"
@dataclass(frozen=True)
class Person:
name: str
age: int
# Sorted in order of preference, most preferred is first.
preferred_operating_system: List[OperatingSystem]
@dataclass(frozen=True)
class Laptop:
id: int
manufacturer: str
model: str
screen_size_in_inches: float
operating_system: OperatingSystem
Write a function with this signature:
def allocate_laptops(people: List[Person], laptops: List[Laptop]) -> Dict[Person, Laptop]:
Every person should be allocated exactly one laptop.
If we define "sadness" as the number of places down in someone's ranking the operating system the ended up with (i.e. if your preferences were [UBUNTU, ARCH, MACOS] and you were allocated a MACOS machine your sadness would be 2), we want to minimise the total sadness of all people. If we allocate someone a laptop with an operating system not in their preferred list, treat them as having a sadness of 100.
Maximum time in hours
3
How to submit
Submit a PR to this repo containing your function (and any supporting code).
- 主要言語
- Shell
- スター
- 0
- フォーク
- 110
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CodeYourFuture/Module-Tools のほかの issue
-
🏕 Priority Mandatory 📅 Sprint 4 Core Module-Tools Submit:None 🦔 Size Tiny
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
CodeYourFuture/Module-Tools#581 ·
-
🏕 Priority Mandatory 🐇 Size Small 📅 Sprint 2 📅 Sprint 4 Module-Tools Recurring Submit:None
難易度 1/5 1〜3時間 初心者へのやさしさ 58/100
CodeYourFuture/Module-Tools#544 ·
-
Install a JDK オープン🏕 Priority Mandatory 📅 Sprint 4 Core Module-Tools Submit:None
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
CodeYourFuture/Module-Tools#480 ·
-
Write a general CV オープン🏕 Priority Mandatory 🐂 Size Medium 📅 Sprint 4 Core Module-Tools Submit:Slack
難易度 2/5 半日 初心者へのやさしさ 45/100
CodeYourFuture/Module-Tools#137 ·
-
Prep Exercises オープン🏕 Priority Mandatory 📅 Sprint 5 🦑 Size Large Core Module-Tools Submit:PR
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
CodeYourFuture/Module-Tools#178 ·
CodeYourFuture/Module-Tools の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
community-scripts/ProxmoxVE#17425 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
danielmiessler/LifeOS#2218 ·
-
agent-research-recommend agent-review-finding
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
jordansmall/spindrift#3714 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
conda-forge/python-feedstock#934 ·