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
| #!/usr/bin/env python3 | |
| # Solves the stolen rubies riddle: https://www.youtube.com/watch?v=2QJ2L2ip32w | |
| import itertools | |
| def main(): | |
| configs = unique_configs(gen_chests()) | |
| # For each "reasonable" strategy (possibly assigning a different number to |
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
| #!/usr/bin/env python3 | |
| # Approximately solves the camel/bananas problem from | |
| # https://www.youtube.com/watch?v=pDoar4zh5tI. | |
| # NOTE: I really enjoyed going back to this from a fresh perspective as | |
| # I first saw it many years ago as a problem in a math class. | |
| # The approach here is to _assume_ you are moving bananas in segments of a fixed | |
| # length, d, and then ask how many bananas you can move in total with segments |
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
| #!/usr/bin/env python3 | |
| # Solves https://www.youtube.com/watch?v=ltsx5389iEs | |
| # The idea is to identify all lights in ⌈log2(n)⌉ moves by assigning each bulb | |
| # an integer and using the unique bit representation of each as the sequence of | |
| # light switches for which it was powered on (1 means it was on for a given | |
| # trial, 0 means it was off). | |
| # NOTE: The bit representation + transpose operation makes the logic most clear, |
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
| #!/usr/bin/env python3 | |
| # Enumerate all solutions to the TED-Ed riddle | |
| # https://www.youtube.com/watch?v=YeMVoJKn1Tg | |
| def main(): | |
| target = [0, 2, 10, 14] | |
| count = 0 | |
| unique_code_sets = set() |
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
| #!/usr/bin/env python3 | |
| # Solves the riddle from https://www.youtube.com/watch?v=6sBB-gRhfjE | |
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| from functools import total_ordering | |
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
| # "Cheating royal riddle" from https://www.youtube.com/watch?v=hk9c7sJ08Bg | |
| # Die designations. | |
| x <- c(2, 7, 7, 12, 12, 17) | |
| y <- c(3, 8, 8, 13, 13, 18) | |
| # Tabulate the outcomes to get counts per face per die. Note that tabulate | |
| # discards non-positive values, but this is fine since all of the values of | |
| # interest are positive. | |
| tx <- tabulate(x) |
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
| // swift-tools-version: 5.8 | |
| // The swift-tools-version declares the minimum version of Swift required to build this package. | |
| import PackageDescription | |
| let package = Package( | |
| name: "WebcamCapture", | |
| platforms: [ | |
| .macOS(.v10_15) | |
| ], |
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
| county | od_deaths | population | |
|---|---|---|---|
| okanogan | 16 | 42634 | |
| yakima | 96 | 256035 | |
| grays_harbor | 43 | 76841 | |
| clallam | 38 | 78209 | |
| mason | 30 | 67615 | |
| king_county | 649 | 2.252e6 |
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
| #!/usr/bin/env python3 | |
| # Exact anagram finder. We start with a target name ("vilepechora") and consider | |
| # all two-name exact anagrams of this target. Specifically, we do not consider | |
| # anagrams of subsets of the original character set. We consider first and last | |
| # names as different types to narrow the search space (there are 1712 matches if | |
| # you consider first and last names to be interchangeable). There are "only" 582 | |
| # matches by considering first and last names separately (based on which dataset | |
| # they're found in). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.