{"id":20621727,"url":"https://github.com/3d-dev/sharedcoursetest","last_synced_at":"2025-03-06T23:18:49.158Z","repository":{"id":134255919,"uuid":"478397122","full_name":"3D-Dev/SharedCourseTest","owner":"3D-Dev","description":"Test of getting the shared course of students","archived":false,"fork":false,"pushed_at":"2022-04-06T04:11:38.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T05:27:40.644Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3D-Dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-06T04:05:48.000Z","updated_at":"2023-03-30T21:38:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"378568a6-71e8-4f70-a8f4-43044a9e9c46","html_url":"https://github.com/3D-Dev/SharedCourseTest","commit_stats":null,"previous_names":["softwareengineer0/sharedcoursetest","3d-dev/sharedcoursetest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3D-Dev%2FSharedCourseTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3D-Dev%2FSharedCourseTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3D-Dev%2FSharedCourseTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3D-Dev%2FSharedCourseTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3D-Dev","download_url":"https://codeload.github.com/3D-Dev/SharedCourseTest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242298974,"owners_count":20104922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T12:19:09.436Z","updated_at":"2025-03-06T23:18:49.139Z","avatar_url":"https://github.com/3D-Dev.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SharedCourseTest\nTest of getting the shared course of students\n\n\nYou are a developer for a university. Your current project is to develop a system for students to find courses they share with friends. The university has a system for querying courses students are enrolled in, returned as a list of (ID, course) pairs.\n\nWrite a function that takes in a collection of (student ID number, course name) pairs and returns, for every pair of students, a collection of all courses they share.\n\nSample Input:\n```\nstudent_course_pairs_1 = [\n  [\"58\", \"Linear Algebra\"],\n  [\"94\", \"Art History\"],\n  [\"94\", \"Operating Systems\"],\n  [\"17\", \"Software Design\"],\n  [\"58\", \"Mechanics\"],\n  [\"58\", \"Economics\"],\n  [\"17\", \"Linear Algebra\"],\n  [\"17\", \"Political Science\"],\n  [\"94\", \"Economics\"],\n  [\"25\", \"Economics\"],\n  [\"58\", \"Software Design\"],\n]\n```\nSample Output (pseudocode, in any order):\n```\nfind_pairs(student_course_pairs_1) =\u003e\n{\n  \"58,17\": [\"Software Design\", \"Linear Algebra\"]\n  \"58,94\": [\"Economics\"]\n  \"58,25\": [\"Economics\"]\n  \"94,25\": [\"Economics\"]\n  \"17,94\": []\n  \"17,25\": []\n}\n```\n\n\nAdditional test cases:\n\nSample Input:\n```\nstudent_course_pairs_2 = [\n  [\"0\", \"Advanced Mechanics\"],\n  [\"0\", \"Art History\"],\n  [\"1\", \"Course 1\"],\n  [\"1\", \"Course 2\"],\n  [\"2\", \"Computer Architecture\"],\n  [\"3\", \"Course 1\"],\n  [\"3\", \"Course 2\"],\n  [\"4\", \"Algorithms\"]\n]\n```\n\n\nSample output:\n```\nfind_pairs(student_course_pairs_2) =\u003e\n{\n  \"1,0\":[]\n  \"2,0\":[]\n  \"2,1\":[]\n  \"3,0\":[]\n  \"3,1\":[\"Course 1\", \"Course 2\"]\n  \"3,2\":[]\n  \"4,0\":[]\n  \"4,1\":[]\n  \"4,2\":[]\n  \"4,3\":[]\n} \n```\nSample Input:\n```\nstudent_course_pairs_3 = [\n  [\"23\", \"Software Design\"], \n  [\"3\", \"Advanced Mechanics\"], \n  [\"2\", \"Art History\"], \n  [\"33\", \"Another\"],\n]\n```\n\nSample output:\n```\nfind_pairs(student_course_pairs_3) =\u003e\n{\n  \"23,3\": []\n  \"23,2\": []\n  \"23,33\":[]\n  \"3,2\":  []\n  \"3,33\": []\n  \"2,33\": []\n}\n```\nComplexity analysis variables:\n\nn: number of student,course pairs in the input\ns: number of students\nc: total number of courses being offered (note: The number of courses any student can take is bounded by a small constant)\n\n\n```\nimport Foundation;\n\nlet student_course_pairs_1 : [[String]] = [\n  [\"58\", \"Linear Algebra\"],\n  [\"94\", \"Art History\"],\n  [\"94\", \"Operating Systems\"],\n  [\"17\", \"Software Design\"],\n  [\"58\", \"Mechanics\"],\n  [\"58\", \"Economics\"],\n  [\"17\", \"Linear Algebra\"],\n  [\"17\", \"Political Science\"],\n  [\"94\", \"Economics\"],\n  [\"25\", \"Economics\"],\n  [\"58\", \"Software Design\"],\n]\n\nlet student_course_pairs_2: [[String]] = [\n  [\"0\", \"Advanced Mechanics\"],\n  [\"0\", \"Art History\"],\n  [\"1\", \"Course 1\"],\n  [\"1\", \"Course 2\"],\n  [\"2\", \"Computer Architecture\"],\n  [\"3\", \"Course 1\"],\n  [\"3\", \"Course 2\"],\n  [\"4\", \"Algorithms\"],\n]\n\nlet student_course_pairs_3: [[String]] = [\n  [\"23\", \"Software Design\"], \n  [\"3\",  \"Advanced Mechanics\"], \n  [\"2\",  \"Art History\"], \n  [\"33\", \"Another\"],\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3d-dev%2Fsharedcoursetest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3d-dev%2Fsharedcoursetest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3d-dev%2Fsharedcoursetest/lists"}