-
Notifications
You must be signed in to change notification settings - Fork 2
feat(algorithms, intervals): most booked meeting rooms #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4ea491f
feat(algorithms, intervals): most booked meeting rooms
BrianLusina 6b61da8
updating DIRECTORY.md
66670c6
Update algorithms/intervals/meeting_rooms/__init__.py
BrianLusina ac30fd4
Update algorithms/intervals/meeting_rooms/__init__.py
BrianLusina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+45 KB
algorithms/intervals/meeting_rooms/images/examples/meeting_rooms_3_example_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64.3 KB
algorithms/intervals/meeting_rooms/images/examples/meeting_rooms_3_example_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+66.6 KB
algorithms/intervals/meeting_rooms/images/examples/meeting_rooms_3_example_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+73.6 KB
algorithms/intervals/meeting_rooms/images/examples/meeting_rooms_3_example_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.5 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.3 KB
...rithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.1 KB
...rithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.8 KB
...rithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.7 KB
...rithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.8 KB
...rithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.4 KB
...rithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.1 KB
...rithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.1 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.4 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.9 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.8 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.2 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.6 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.8 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.4 KB
algorithms/intervals/meeting_rooms/images/solutions/meeting_rooms_3_solution_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
algorithms/intervals/meeting_rooms/test_most_booked_meeting_rooms.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import unittest | ||
| from typing import List | ||
| from parameterized import parameterized | ||
| from algorithms.intervals.meeting_rooms import most_booked | ||
|
|
||
| MOST_BOOKED_MEETING_ROOMS_TEST_CASES = [ | ||
| ([[0, 5], [1, 6], [6, 7], [7, 8], [8, 9]], 2, 0), | ||
| ([[0, 10], [1, 11], [2, 12], [3, 13], [4, 14], [5, 15]], 3, 0), | ||
| ([[0, 9], [1, 2], [2, 3], [3, 4], [5, 6], [6, 7], [7, 8], [8, 9]], 3, 1), | ||
| ([[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]], 1, 0), | ||
| ([[0, 4], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]], 4, 1), | ||
| ([[0, 10], [1, 5], [2, 7], [3, 4]], 2, 0), | ||
| ([[1, 20], [2, 10], [3, 5], [4, 9], [6, 8]], 3, 1), | ||
| ] | ||
|
|
||
|
|
||
| class MostBookedMeetingRoomsTestCase(unittest.TestCase): | ||
| @parameterized.expand(MOST_BOOKED_MEETING_ROOMS_TEST_CASES) | ||
| def test_most_booked(self, meetings: List[List[int]], rooms: int, expected: int): | ||
| actual = most_booked(meetings, rooms) | ||
| self.assertEqual(expected, actual) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.