diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad59702..1d362c8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,7 +61,7 @@ New problems, extra solutions and corrected test cases go in [`content/`](conten - **Write solutions** for problems the upstream data has few of (Kotlin especially), in `content/`. - **Triage wrong verdicts.** Reproduce a reported case and, if the test case itself is invalid, add it to the exclusion list. - **Kotlin reference solutions.** The upstream dataset has very few, so the Solutions tab falls back to Java. Contributing Kotlin solutions upstream to [doocs/leetcode](https://github.com/doocs/leetcode) helps everyone. -- **Special judges** for problems that accept several valid answers (for example "return any valid arrangement"). +- **Answer checkers** for problems that accept several valid answers and don't have one yet. A checker is a small function in `backend/localcode/judging/checkers/` that decides whether an answer is valid for the inputs; see the existing ones and their tests, and run `make check-checkers`. - **Accessibility and keyboard navigation** improvements in the web app. - **Docs**: troubleshooting tips for platforms we haven't tested (Windows, Linux distributions, low-memory machines). @@ -75,6 +75,7 @@ New problems, extra solutions and corrected test cases go in [`content/`](conten ## Maintainer tasks -- **Regenerate the test-case exclusion list** after a dataset update: `make validate-cases` (about 45 minutes with three runner replicas), then commit `backend/localcode/data/excluded_cases.json`. +- **Regenerate the test-case exclusion list** after a dataset update or a judging change: `make validate-cases` (about an hour with three runner replicas), then commit `backend/localcode/data/excluded_cases.json`. It also prints two lists to act on: problems whose references differ from the expected answers only in list order (give those a mode in `backend/localcode/judging/answer_modes.py` and re-run them with `--only`), and problems whose exclusions rest on the references agreeing although none passes half the suite (check that those inputs really break the problem's constraints). +- **Check the answer checkers** after a dataset update: `make check-checkers`. Every checker must accept the dataset's expected answers on every non-excluded case. - **Check reference pass rates** against a scratch instance: `backend/.venv/bin/python -m localcode.tools.sample_refs -n 100`. - **Release:** move the `Unreleased` section of [CHANGELOG.md](CHANGELOG.md) under a version heading, tag `vX.Y.Z`, and publish a GitHub release. diff --git a/Makefile b/Makefile index 0bbd250..0252387 100644 --- a/Makefile +++ b/Makefile @@ -63,10 +63,18 @@ update: ## Re-download sources and rebuild problem data (your progress is kept) validate-content: ## Check content/ against the running stack (FULL=1 also runs local solutions on upstream tests) docker compose exec -T -u localcode app python -m localcode.tools.validate_content $(if $(FULL),--full) -validate-cases: ## Maintainers: regenerate the excluded test-case list (slow) - docker compose up -d --scale runner=3 - docker compose exec -T -u localcode app python -m localcode.tools.validate_cases /data/excluded_cases.json - docker compose cp app:/data/excluded_cases.json backend/localcode/data/excluded_cases.json +validate-cases: ## Maintainers: regenerate the excluded test-case list from the unfiltered sources (slow) + docker compose up -d --build --scale runner=3 + docker compose exec -T -u localcode app python -m localcode.tools.validate_cases \ + --from-sources /data/validate /data/validate/excluded_cases.json + docker compose cp app:/data/validate/excluded_cases.json backend/localcode/data/excluded_cases.json + @echo "Order-only differences (give these a compare mode):" + @docker compose exec -T -u localcode app cat /data/validate/excluded_cases.order.json + @echo "Exclusions to confirm by hand (no reference passed half the suite):" + @docker compose exec -T -u localcode app cat /data/validate/excluded_cases.review.json docker compose up -d --scale runner=1 -.PHONY: help up down logs setup test test-backend test-runner test-web lint format dev-web api-types screenshots smoke update validate-content validate-cases +check-checkers: ## Maintainers: every answer checker must accept the dataset's expected answers + docker compose exec -T -u localcode app python -m localcode.tools.check_checkers + +.PHONY: help up down logs setup test test-backend test-runner test-web lint format dev-web api-types screenshots smoke update validate-content validate-cases check-checkers diff --git a/README.md b/README.md index b5ba4d7..df0d3d8 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ flowchart LR I --> F["filter invalid test cases"] --> DB[(content.db)] ``` -The upstream test cases were generated by running Python solutions on synthetic inputs, and a few of them break the problems' own constraints (for example 64-bit values where a problem promises 32-bit ones). The importer removes cases the typed languages can't represent. It also applies an [exclusion list](backend/localcode/data/excluded_cases.json) of about 1,300 cases that the Java and C++ reference solutions reject, produced by running them over every suite. +The upstream test cases were generated by running Python solutions on synthetic inputs, and a few of them break the problems' own constraints (for example 64-bit values where a problem promises 32-bit ones). The importer removes cases the typed languages can't represent. It also applies an [exclusion list](backend/localcode/data/excluded_cases.json) of cases that the Java and C++ reference solutions reject, produced by running them over every suite with the same answer checking users get. See [NOTICE.md](NOTICE.md) for attribution. @@ -160,7 +160,7 @@ docker compose cp app:/data/user.db ./localcode-user-backup.db ## Known limitations - **Kotlin reference solutions are sparse upstream**, so the Solutions tab shows Java for most Kotlin problems. Kotlin submissions are judged normally. -- **Problems with several valid answers** ("return any valid arrangement") are compared against a single expected answer, except where the statement says "in any order", which is compared ignoring order. +- **Problems with several valid answers** are judged by checking the answer, not by matching one expected output: 74 problems ("return any valid arrangement", course orders, Gray codes, CIDR covers, …) have a checker that validates the answer against the input, and "in any order" answers are compared ignoring order (at every level where the problem allows it). A multi-answer problem without a checker yet is still compared against one expected answer; please report it. - **Design, SQL, shell and concurrency problems** can be read but not run. - **C++ is compiled with Clang 19 and `-std=c++23 -O2`**, as on LeetCode, but without AddressSanitizer, so some out-of-bounds bugs that LeetCode would report may go unnoticed. - **Cold-start compile times** are about 1 to 2 s for Java and C++ and about 4 s for Kotlin. diff --git a/backend/localcode/data/excluded_cases.json b/backend/localcode/data/excluded_cases.json index 5f9bf72..ec49939 100644 --- a/backend/localcode/data/excluded_cases.json +++ b/backend/localcode/data/excluded_cases.json @@ -1,1778 +1,5226 @@ { - "3sum-with-multiplicity": [ - "90eee1e5a5007d5b", - "935d03fea778aaf7" - ], - "advantage-shuffle": [ - "78a955c43eb2f05b" - ], - "alphabet-board-path": [ - "3cc43fff2c266151" - ], - "alt-and-tab-simulation": [ - "f751436941b007d6" - ], - "apply-discount-to-prices": [ - "aeb8fb56533e74b7" - ], - "arithmetic-subarrays": [ - "c4be070e9d944f47" - ], - "average-salary-excluding-the-minimum-and-maximum-salary": [ - "426a7dc83b5aff54", - "66b83abf25bc3f40" - ], - "basic-calculator-ii": [ - "14cbf4720c9b07ab", - "2410377ec0642512", - "3684b89944935610", - "5a9aa5e50870d97c", - "d0805c29d48b0496", - "ea11dfededdd315a" - ], - "brace-expansion-ii": [ - "549add7b664f8da7", - "fc2c05a79c0da646" - ], - "car-fleet-ii": [ - "ca25b90f45d516b8" - ], - "car-pooling": [ - "c6f32eca46b8fea5" - ], - "cells-in-a-range-on-an-excel-sheet": [ - "00f3d5da282f5973", - "049fb0fba71e5649", - "07b50fb8acbea7c3", - "0a5bfb02a31be7d9", - "0d2af3cd0aaf2f55", - "10e4f6f78bfb834c", - "182b1a3135174a26", - "1dd6bbde176be96f", - "1f0748401f1e0d35", - "2ab0037244e5028a", - "2e772ce53a1d1710", - "355034257d3210c8", - "36f9acde35647d68", - "3db50992ae2ce294", - "406cc4cb54b834f0", - "432739a1d328cc9c", - "433b85f35ceaa0c5", - "441a4fbeea6008e6", - "53b196c28f63ff8c", - "5750d005f587e42f", - "5d2afe70dde5005c", - "5f899ae724b29ef1", - "63b9510f7314e33e", - "6fe802743a75cd81", - "76c5f019f63019b9", - "85a29ab3768bd82e", - "8fb7d90ad3d2861c", - "90e4da20f2526fa4", - "918e3d523db798d2", - "9823ca4c7fb23c3c", - "9941e1258fb0189e", - "a1a1a693fa9b8c43", - "a5658b9d546b9aee", - "a806830fcec7aa14", - "aa5698a7601c6a5d", - "ab082eac82fe7876", - "b063a4ae2b7eb60b", - "b0f5d2dbaed77e25", - "b6ba743147130f28", - "b92b1b3729d72bf6", - "d64e0cc3df07e5d8", - "da03c720cd8a6777", - "dd314f898c9f5564", - "dd48d6aaf5525c09", - "eba18540c47df807", - "ec4d67686899dda7", - "f817fc85e4f345a0", - "f89608a64e5f21da", - "fa0872dc7dd74fc4", - "fdcfcd427e5a9296" - ], - "check-if-all-characters-have-equal-number-of-occurrences": [ - "665f66b0cf05eb7f" - ], - "check-if-every-row-and-column-contains-all-numbers": [ - "9b37b577259e73a7", - "ca8f6f2202eb96b0" - ], - "choose-edges-to-maximize-score-in-a-tree": [ - "02652f58fb194d40", - "04ad1878bf832be4", - "4353dbc969629e39", - "55dd01ff574182dc", - "7ca814d4f044561b", - "cfcde26ecbddc923", - "e8caa7128c8d3eaa" - ], - "closest-divisors": [ - "8f5cc3d3dc5cbc1a" - ], - "collect-coins-in-a-tree": [ - "7decb78320ebba0c", - "a41486e69a41adc9", - "ad6a8209feac5f65", - "b5fa397d7bd413d8", - "cd5390ea18b2efbc", - "e85bf5528ad9417c" - ], - "consecutive-numbers-sum": [ - "8f5cc3d3dc5cbc1a" - ], - "construct-string-with-minimum-cost": [ - "82656a20e0d91cb4" - ], - "convert-an-array-into-a-2d-array-with-conditions": [ - "0ba37f2650119659", - "0d5a4dcddc756357", - "0ea171666b9ddb6c", - "0f6ca61ac20b5119", - "1519e7ae039d5324", - "2f65f8f3966ee0b7", - "3af871595e99a1fa", - "3f42625bd1fa7b65", - "4358e3f1ba0ba889", - "49f0615f9e97f20e", - "4c455b08e40655ce", - "530fab5706b65f54", - "5a357ee0d55c92ab", - "8844b0454e34ea9e", - "8c14822cf1fe36e7", - "b213f87fd6cfcff3", - "ba5b19310bad72c4", - "be2ddbaeedcafee0", - "c00ba36e1c295c78", - "c0f19b61d88be355", - "cb78ac63eeb8e399", - "d01b72e41dc18fce", - "d261c424463dafe1", - "e380956e5193f5a8", - "e87c1970e8e58b6d", - "f14b2d5d005000bc", - "f1ee20fdbad7e832", - "ffb3507e064577cc" - ], - "count-number-of-rectangles-containing-each-point": [ - "ee437cbb16dba5d0" - ], - "count-positions-on-street-with-required-brightness": [ - "5f89bc554ae523ca", - "db26474362886dd3" - ], - "count-special-subsequences": [ - "86f741d4aa809f08" - ], - "count-substrings-that-can-be-rearranged-to-contain-a-string-i": [ - "1a61b9e471770461" - ], - "count-the-number-of-fair-pairs": [ - "1c33cb8a8b5d758b", - "99bdee9e4480fc4b", - "a23fe6ed2fa84b9c", - "af987bf4f951179c", - "deef2a8a0fd11b38", - "ebb4bf3b89df6f23" - ], - "count-the-number-of-vowel-strings-in-range": [ - "a188714e2b54f6d4" - ], - "count-unique-characters-of-all-substrings-of-a-given-string": [ - "8f19a5c07e128336", - "dffc0afec578ab93" - ], - "count-words-obtained-after-adding-a-letter": [ - "0d4426bb54520e95", - "2eb323868ecba9ff", - "6c6b4d4063d83da1", - "d048f0744ad79d41", - "e591ec40e64a7d30" - ], - "counting-elements": [ - "1fd87c6173b65ca9", - "29d311b10933772f", - "331359d6a2e2ece3", - "57ba542c2a39d6df", - "5a13e632d046115c", - "80da361819220d92", - "db42391058c8dcf9" - ], - "course-schedule-iv": [ - "4022893714c14c98", - "82c36d039095425c", - "baccacc18896c44b" - ], - "create-target-array-in-the-given-order": [ - "07fcee8ccdc13d17", - "176ac8cbdd752aa5", - "1bc6716446835ac9", - "1d2ee0de4414b421", - "248054ae017d5fa3", - "2fa9b527ebe75dca", - "3481a0a0cc5dd51c", - "363f314b30a2a50b", - "373a9a8090cee169", - "3d434801e9d6df29", - "3ed82d324e5af85c", - "4066cec016007ebd", - "41994bec0d1727a0", - "444b07abf75ef3b6", - "59e73150dcf4b8cb", - "5e7f56c2c50ed8f1", - "600205495dc86a64", - "61962176bb22ecbd", - "6443d711a4aa1bf4", - "654739935610682d", - "6f10fcc908229a3b", - "7343bc7e9e74e988", - "78452e8159a54a09", - "7da1287ed74ddba3", - "7da1287ed74ddba3", - "848e1dcdbf0a3956", - "8748f2b3219991a7", - "882b6dc56941a26f", - "8a13354c821d1d5f", - "94d06b871a8128f6", - "a0ba19a19661b981", - "a3995682dd58769f", - "acb5816c3754ae4b", - "b0af60879ddcc27d", - "b20732de8b336f3b", - "bac9947de757b3d1", - "bdb36bc10284dd0f", - "c91b41c07060e152", - "cbd329c86e577765", - "ce4a7594e7f2d949", - "d6e34a49ba739a81", - "daeae49b57281423", - "e827b50f8a1388a6", - "f424930bcce6aa5f", - "f51e807dc667897a", - "f85390dfb64d6081" - ], - "decrypt-string-from-alphabet-to-integer-mapping": [ - "b682c51a0e4b4ce7" - ], - "delete-and-earn": [ - "4dc037733e02ef85" - ], - "delivering-boxes-from-storage-to-ports": [ - "52b63f4b590d596f" - ], - "depth-of-bst-given-insertion-order": [ - "39cfafb32d36a879", - "477ce47d10d5e2b8", - "e0b10429797b9386" - ], - "different-ways-to-add-parentheses": [ - "146090e9102e68f1", - "2ddc33dd1d3a17d9", - "325186779b1cfc22", - "9303b47f93d7935c", - "e790da9b57ad75e2" - ], - "divide-an-array-into-subarrays-with-minimum-cost-i": [ - "6a491d0e647be997" - ], - "divide-an-array-into-subarrays-with-minimum-cost-ii": [ - "1ae2689b23d46eb7", - "1ae2689b23d46eb7", - "4cb0b4f1c49aeef1", - "75c19ab736399123", - "aa82bfbb9e53101f", - "cda6c8db71b11ec1", - "d574ddc475741200", - "f4b8e8bb0f39d55c" - ], - "erect-the-fence": [ - "16aa088d4fbc3d26", - "360c16e38b392049", - "bcc296e1c34998f3" - ], - "evaluate-reverse-polish-notation": [ - "075a3279eacc67ad", - "203266c1e3a634f2", - "254b7fc601db51b6", - "3069334f46ee0ecf", - "42af9663f1595e8c", - "70bc09906892c164", - "70d372a098bc6a4c", - "73bcc189cacc0df7", - "7e7a28733cf11ec0", - "a97baf2b8303a0e7", - "b77afe32935ac36d", - "c44f06b7d05c4106", - "c4af643b03956a7b", - "cc767ee540823cbf", - "ed067dab6a5af0d1" - ], - "find-a-good-subset-of-the-matrix": [ - "210b43d9328a23f0", - "263b753eab9243cc", - "3f34da45648f8438", - "58326f9c64e9f16e", - "5b6efd0adda04baa", - "6fc84f74b4e55fa3", - "958fe526dd967331", - "b6b9848eddc8f11c", - "b7eff0ef20441739", - "bf3f4f016e360201", - "c5fdd0dc57efa0c0", - "c938a0ebb8e81864", - "ce15dbae7b1d18a9", - "e3e47704b0557efe" - ], - "find-all-numbers-disappeared-in-an-array": [ - "002712ac1b41c4c3", - "0ba576ba73776ae7", - "1470b4576a9f534c", - "4454ce968a332cda", - "4ae706c79c077d54", - "7ad4a67f87c9b669", - "854d37a650cf6b78", - "b7060f9ceb29d6ae", - "db4ac0d0ab128c60", - "dbf688afa7b59a81" - ], - "find-and-replace-in-string": [ - "64fb4ff71606a0b5", - "f40f3687fa466bc2" - ], - "find-and-replace-pattern": [ - "ff80b6f430f7d843" - ], - "find-eventual-safe-states": [ - "012438fd2eb3c487", - "052e2f26118b5345", - "05be78f2d716afec", - "2004397a654857e7", - "2c0e3704486bf77c", - "57c660c87747bdf9", - "644ec9e5f8f26162", - "6be973e6aef782c5", - "80266d3d20032ea7", - "806984a60dc3a592", - "8d20c5aa6f3f117e", - "bd87cb29ae6693e7", - "dd76bfc30e45ee7d", - "f52ec084bd443d56" - ], - "find-kth-largest-xor-coordinate-value": [ - "ddeeee58351464f9" - ], - "find-maximum-number-of-string-pairs": [ - "1641f971a1627648", - "1c16bd3d2e857a65", - "67062760fea4fc5d", - "67e88138ee6cd704", - "6b6be14237016efa", - "74db8c555d37658d", - "a0be34c6461e666d", - "aa503196eb5f546c", - "d8917ac1af7cd0a4", - "e3fa7f5c43bbf37f", - "eb768f9864040c13" - ], - "find-maximum-removals-from-source-string": [ - "29dc987440b84c37", - "3f7c7ad805d078b0", - "4806674718ce58af", - "7cf13d061e256533", - "e4b401d8479e736d" - ], - "find-minimum-diameter-after-merging-two-trees": [ - "54b61807dc547269", - "89b1f90e479be9d5" - ], - "find-minimum-in-rotated-sorted-array": [ - "006890f8a729a1df", - "1295d282405dabc1", - "2dfee1b753394fbc", - "2eb06c62e2087aad", - "3b8489cbf819f3c7", - "b09a49300b130991", - "f6519bcb3846da3b" - ], - "find-missing-and-repeated-values": [ - "07123d07478d0e82", - "16f17648fd96fe86", - "2db29bb6ba5c5387", - "32764d3f296d037f", - "469f4bb6f87b6118", - "758a224f3fccac34", - "8b5d7de5c6c887de", - "8e6279a0a0cd3cc7", - "ab3c78679f765e08", - "b2fa5effbaffa052", - "b6b096aec8528682", - "d4853f027c2b94cc" - ], - "find-occurrences-of-an-element-in-an-array": [ - "86c14c3c59654319" - ], - "find-servers-that-handled-most-number-of-requests": [ - "2b515f9129a0161d", - "83c32117e4f3b29b", - "a92383f5e4b3d691" - ], - "find-the-array-concatenation-value": [ - "012bd310bdda02b2", - "265ff0e4823bc554", - "2931eb7016c161a4", - "315be98d3aa98857", - "4085116661863c48", - "52663f22d15b1910", - "582a9f455fbe0c10", - "65f016dcb3068420", - "845551b1e9f15ef7", - "8833affc5128c2f4", - "885221f9873ca9d4", - "8abba44719cc0bd5", - "8cc940fb17561d4f", - "9b64999be9e55a92", - "b776d19b0e0f61d4", - "bc272f725b286ac5", - "c51f6fbba7375a41", - "ce9dae956d68e1a7", - "d0ef24eb4195a01f", - "d0ef24eb4195a01f", - "d9531eeab4e6acb6", - "e9d37373d91a8abb", - "ee24a916a3c4487a", - "f8a0cfb0d65c3772", - "ff52ac4d65772215" - ], - "find-the-difference": [ - "b8852970cb3fcaa9" - ], - "find-the-difference-of-two-arrays": [ - "047f2e5f9f37bbe9", - "0dad89ebbec81c2d", - "0f8966eca063b580", - "151faaa2c1e104ff", - "16464d8036afa5d0", - "188405ce7f1e94f2", - "217612de44dcc79b", - "285f5782dacd826c", - "29fef7c202ac8fc5", - "2dd9c309782f9171", - "2df5a365fd569d76", - "3079b4ef6eff1191", - "402e068a4c016cf9", - "40960d7583d88eb0", - "54af4c14c4f46d23", - "58651c88025462d1", - "59d8a54f1b5e5b92", - "7087c86d3d59f05e", - "7b9bd1fa901fb8cf", - "8323f6a0a785d15f", - "85a22518efba3ff4", - "85a34061dec835fd", - "86ed0409381ccd1a", - "88c3ab9a5550b981", - "92317812eccc6ab3", - "92ada7899283250b", - "96bf763862fe34f2", - "9ad20d6128932d64", - "a1243e1b89115ac0", - "a9d63245ef11e76d", - "aeb2ddf491ef22f4", - "b6152d79d5e4eebe", - "b68eac679766b64b", - "b8f916a3ba58abaf", - "bf31c64efb0c1ee0", - "c19ef99192a2500b", - "c19ef99192a2500b", - "d3bc4d3a56ce906a", - "d4dcbb9006ffc221", - "e02b1956d3f44755", - "e899d37e4ffd22ad", - "f567e6c10da2b7c3", - "fafd1fb38faff1a5" - ], - "find-the-duplicate-number": [ - "227557900527f96d", - "43a93011be205c92", - "47d5cada6ef27e70", - "6c9a22decc101364", - "9804e5481e1da79e", - "aeea687f57d723d4", - "ba7a0360b04c15e3", - "c2ae2be553128f00", - "c8800cc260c99401", - "e3979e549e889e15" - ], - "find-the-k-th-lucky-number": [ - "8f5cc3d3dc5cbc1a" - ], - "find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows": [ - "f5aa2713c347302c" - ], - "find-the-lexicographically-largest-string-from-the-box-i": [ - "fad483d733425603" - ], - "find-the-lexicographically-largest-string-from-the-box-ii": [ - "0f430e1d3a43b28b", - "79844c7758109e15" - ], - "find-the-maximum-number-of-fruits-collected": [ - "e2e4133c0b895d45" - ], - "find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k": [ - "2748597a4ea36240", - "45f9490be8628f0f" - ], - "find-the-original-typed-string-ii": [ - "f866dcb9391ecbca" - ], - "find-the-prefix-common-array-of-two-arrays": [ - "79c0a9c2bc308379", - "8e93fb35e57004d8", - "99134479a0dcc01e", - "a524bfc8122e6fbf" - ], - "find-the-shortest-superstring": [ - "2589d6c84968865a", - "3741cd00c5dca03a", - "45863d52a6c8e29c", - "4886bf25c0b6d5f1", - "4b4d6dab8e0cde6e", - "63a1f18aed010b98", - "67c1d3e5ed3d0719", - "76067c0f5dc87530", - "7bf6a0783b428b76", - "86f7fdbb1d428589", - "ae2f22961b71db90", - "b49de2957764441a", - "b9c59237d36b0971", - "ba754f1919dd54a2", - "d547ebfec815f055", - "e48a85405b9149dd", - "eb4bca78c17a69f1", - "ee81fa517a739d03", - "f5e16c8423f534f8" - ], - "find-the-smallest-divisor-given-a-threshold": [ - "16921a751450cd46", - "943553ef22d8154f", - "f5cbe30a31d53814" - ], - "find-the-substring-with-maximum-cost": [ - "0aca144b9ee62637", - "cacb07bd54ede416", - "ffcb3bed4a746b63" - ], - "find-the-width-of-columns-of-a-grid": [ - "c9b0df096a9b5b89" - ], - "find-the-xor-of-numbers-which-appear-twice": [ - "333f429c5330bd70", - "3f08ccb79d5ec66d", - "4f36ba8d7a002808", - "4fee493397c7ae50", - "987488758e3ce47a", - "99e64faf034e566a", - "a8b056f7cf717d4b", - "b737ae0bbaea4d25", - "b7b03df0cce50964", - "be60bc66e83ba51a", - "bff6cd8051a509fe", - "c0a9da398c9beec5", - "c69b4c39a115ef5a", - "cefdd1b01f03c57e", - "f6df7d3eca49d97b", - "fbae659318536d75" - ], - "find-words-that-can-be-formed-by-characters": [ - "e0fc497a000882b0" - ], - "flipping-an-image": [ - "085a06e627d2a76c", - "4cb844a7b25471b5", - "76b87dd285829503", - "7a6dc55d4b00fe6c", - "9690136cdc1e7c52", - "b2330165ee108bf7", - "cd28b60228290923", - "db5dda3afa5f4284" - ], - "fraction-addition-and-subtraction": [ - "099f321252f37d98", - "58e3b981132ca8a2", - "727e3ebc10f5e786", - "85909548392bbf7e", - "9827a53fd89d59ed", - "9e4b13def894dc88", - "b8e6f7434b2df953", - "c779a088c1000702", - "d53ed9dbae2b62f9" - ], - "greatest-common-divisor-of-strings": [ - "69e355245bf65e48" - ], - "greatest-common-divisor-traversal": [ - "213317db76ab92ab", - "61ba69f52cc0efc5", - "9cfd5989a28ddd60", - "aa7e475324251f0f", - "fb52f1825ba7ae54" - ], - "hexspeak": [ - "2bbfce30cbba689b", - "2f36be4cae90a769", - "6d5f60a10118c538", - "8852f26bd7f83f80", - "a33c0586c989796e", - "ba2440ea0c268d39", - "c213a25c482ddebc", - "cf30d4ffec968fb2", - "d27484f79c172c35", - "d8ca1413a4920925", - "db75cf354948e052", - "e48031eeeea3b463", - "f6cebb3019a57e50", - "f92e882187ece3ed", - "fb5f3ce990d20552" - ], - "high-access-employees": [ - "099045be2251ed11", - "0d71179d41c364a8", - "4ee9df21a7a66c99", - "58a0874f54c9c792", - "7cf6aa2881858b28", - "94f5b2c177384e1b", - "9af3e79facb62ae9", - "9af3e79facb62ae9", - "a8a452e7258f92d8", - "ac4504b3790aa5df", - "d6e66c06cc9e96b0" - ], - "house-robber-iv": [ - "4f8c3afcb396140e", - "60d4962378b50186", - "c71f3678e3c4753a", - "c81aedffd70ef8ef", - "e514252136408e8c" - ], - "intersection-of-two-arrays": [ - "1b71f13635904a51" - ], - "isomorphic-strings": [ - "0414a14c8625e2dd", - "c5af7996092c97f7" - ], - "koko-eating-bananas": [ - "1176c6bd91427779", - "141c696b3adc1a31", - "1a8307b64ffa3ef7", - "2741b59be7f49f0f", - "293959a58f9b6623", - "34e5b7a117a19420", - "34e5b7a117a19420", - "4b27f7c3c72dcd0a", - "51df8183d98fcfad", - "5ef8dc67aa5633fa", - "5fc756e4d5e5aabf", - "63c8e8ab745f67ad", - "7537fcb7dfcaf5eb", - "9374a65aae2fea79", - "943553ef22d8154f", - "973d37ea46cb98ae", - "a7cb603c71874713", - "bf8e9200bad3b9bc", - "c6f7c3ddedeed8ec", - "f685864e7d318506", - "f685864e7d318506", - "fcc340a0e8255a02" - ], - "kth-smallest-product-of-two-sorted-arrays": [ - "071f4a26b5946307", - "1735fa50412768ad", - "1c2578a3c9047dc9", - "289e29d2672640b7", - "38e603d3f9604711", - "392741d157a3cccb", - "41b66c668433dff1", - "56e3965d66da001c", - "5cbe5d00cf8656dc", - "90e135f1e2d25f3a", - "ad532b032934160e", - "d3725ca57bbc0e4f", - "f25cbfe6e16fdacc", - "f434d9858f903c47", - "f98cab5aac4d2ae4" - ], - "kth-smallest-subarray-sum": [ - "3b921a9078079634", - "40c86fba89287ea0", - "4586683bd18d4941", - "53ab584e740b42c0", - "5bba9eccf8ea4ec9", - "815d4d5748781f2f", - "850ab9ffefaf9224", - "86467272a8401024", - "97399d60e6f3f8f6", - "b6f4fc067bd5ac26", - "b89d0815124a5ce7", - "b8a34468de9f0d8e", - "c0333c707d99ded6", - "cf76cf5d9352a014", - "e2cfa9122e7931ff", - "ea20f51d5618f04f", - "ec6866edbdf8e200", - "f1a93a538def8326", - "f3e9fa84ad9fc5aa", - "fad5a3aaf72ced88" - ], - "largest-number-after-mutating-substring": [ - "0f5b50f45c24d818" - ], - "largest-unique-number": [ - "3158d1989be89750", - "5989ac92c885e212", - "eb4744d380ce307b" - ], - "last-day-where-you-can-still-cross": [ - "7af5f01ef576ae16" - ], - "latest-time-you-can-obtain-after-replacing-characters": [ - "0b2d50439b80608c", - "1b48b698d3f086ac", - "325deca46ea2ed04", - "4fe2e8c735e767f4", - "53627407a51a549e", - "56da5f08909dba58", - "5aa78e0eeae14cae", - "67bf3c56e220edf0", - "8d7b4e5d4f4a88b1", - "8ec47d0cf51d7414", - "94ed93a084102b93", - "cf954aba2d4f36e1", - "da2d279586a9dafc", - "ebccb0074a522ad6" - ], - "letter-combinations-of-a-phone-number": [ - "7368aeeaa22c7343", - "8a78127b265a9491" - ], - "lexicographically-smallest-string-after-applying-operations": [ - "0e25afb162964c3c", - "1a16a1426ad5a55f", - "2a1a4645ac5c4b5e", - "4e818e50379c5439", - "66952ea0d87e1172", - "a9e7689512539de8", - "b4b4a00ca6f9e48f" - ], - "longest-common-suffix-queries": [ - "3ed905d9c0e1bd15" - ], - "longest-palindromic-subsequence-after-at-most-k-operations": [ - "07fcccdd4ed3456a" - ], - "longest-substring-of-one-repeating-character": [ - "0b765ee4be50a5a8", - "1a1a3ffc0d9ae535", - "23b76f1a256b609e", - "5f3cbb68ad6615f9", - "69690ed38cdc2eed", - "6afa85fd41048a43", - "d732a525fe3647b5" - ], - "make-array-zero-by-subtracting-equal-amounts": [ - "4332dbed06f0f975", - "51ed758338c345d5", - "779c254346775400" - ], - "masking-personal-information": [ - "063148798017c1fa", - "e4243bbd50d4ad16" - ], - "max-points-on-a-line": [ - "295f761b14260797" - ], - "maximize-happiness-of-selected-children": [ - "0fa22149a261db1e" - ], - "maximize-the-distance-between-points-on-a-square": [ - "1e5413d6c82458e2", - "471d57d00384adae", - "51a03d68a61af904", - "51fc09a0eb3624c9", - "6685e6f372b6f848", - "7f53f7b29634f3be", - "e52881e9a6a97bda", - "f1abe6a44630e438" - ], - "maximum-average-subarray-ii": [ - "ccd8ea32c478f956" - ], - "maximum-gap": [ - "c41b7b4383ed4b60" - ], - "maximum-number-of-moves-to-kill-all-pawns": [ - "136cf5a4bd18f65c", - "141078365e4b07c5", - "15505cb78cc6f26b", - "79672d9a30907565", - "ef4947ee57255189" - ], - "maximum-number-of-vowels-in-a-substring-of-given-length": [ - "bd2cd93b77a76a33" - ], - "maximum-number-of-words-you-can-type": [ - "06e0ad161c3cfbbb", - "be3794554f04ee5e" - ], - "maximum-performance-of-a-team": [ - "77d845d45c228ee1" - ], - "maximum-product-of-the-length-of-two-palindromic-substrings": [ - "63de10428590c503", - "6c224cb06a270dee", - "816f5c0848c6a684" - ], - "maximum-score-of-spliced-array": [ - "e5c3751d61527d75", - "fa92588716875e43" - ], - "maximum-strong-pair-xor-ii": [ - "2d004c2d5148b08e" - ], - "maximum-subarray-with-equal-products": [ - "38b74840439b22f2", - "38b74840439b22f2", - "3a0c7c1012c3ebd2", - "3a0c7c1012c3ebd2", - "778028853f56f742", - "8391b6aa91f613b8", - "ab3cd0fc07ace07f", - "e453938fa85d39f5" - ], - "maximum-sum-of-3-non-overlapping-subarrays": [ - "15a33445e592d230", - "c415525cbe529648" - ], - "maximum-total-area-occupied-by-pistons": [ - "09cb931504b28ed8", - "365fc45bab3c62c5", - "8156f63c7aa04ba0" - ], - "minimize-deviation-in-array": [ - "07053329220da202" - ], - "minimize-result-by-adding-parentheses-to-expression": [ - "1aaddf273da41e81", - "2f51300f3f9af1b0", - "c2479706c99d79db", - "d4b266f0cf03ff84" - ], - "minimize-the-difference-between-target-and-chosen-elements": [ - "22a0fb12d56e5d51" - ], - "minimize-xor": [ - "1e90b186264f0e8c", - "266527e63230b423", - "42b244f9e0bbdcec" - ], - "minimized-maximum-of-products-distributed-to-any-store": [ - "14b95a9aafe8793c", - "14c2167ce39a7a4f", - "88218bba2a6c9e49" - ], - "minimum-area-rectangle": [ - "2831a1cf090c3e87" - ], - "minimum-cost-homecoming-of-a-robot-in-a-grid": [ - "f880497e851f3aed" - ], - "minimum-cost-to-change-the-final-value-of-expression": [ - "e1dd9c7489573368" - ], - "minimum-cost-to-convert-string-i": [ - "1d10c78738652fe2", - "2d83a3a64f2b6ac4", - "6111eec2b2982ea1", - "626303caf21d8940", - "b46f8496657e60b4", - "c85f719926b077fa", - "d154ed759b154fec", - "fd77ea2d229ec13b" - ], - "minimum-cost-to-split-an-array": [ - "141c696b3adc1a31", - "14785029eb365f94", - "248fadc032a9a7b5", - "3cfdf26285dbb009", - "41d98db3eb9a1d59", - "57989759cf973c94", - "76f9105fcd202d9f", - "7efd52d0aa5ee9e0", - "a1758b9ccec9e4e8", - "a8d9784028e03541", - "b02377513120626d", - "b3cdb8d18e3617c6", - "da1863fe495e7906", - "eaeab626cdb7a58f", - "ebdf93789d37d132" - ], - "minimum-domino-rotations-for-equal-row": [ - "0cc7a3742908b259" - ], - "minimum-falling-path-sum": [ - "015139e29bc0c642", - "33a5d7a795899a79", - "7d8df3e498f0cc9e" - ], - "minimum-knight-moves": [ - "042a7e382616312f", - "0517996cd0b79387", - "1eade71beb0a5421", - "2236892efc0324e2", - "22e472849a25aa56", - "26db081efba2e1c7", - "425f24d291524c37", - "465bc993d5f0dd14", - "470c411a2764af27", - "4c44455a2f0989a4", - "4c99ede9577d0081", - "54c3a1f5ae31f1f8", - "6cc1b83a21d3650d", - "730d052964d83430", - "766eed8525ea6d53", - "8008e3cc15ed0d51", - "82121add0ddf0ee8", - "96145b4b7d5071d2", - "b16c5a058a40d72a", - "b746641c6c7afbaa", - "b7e73df1ab484fa7", - "bd8607aea9503e63", - "cabe3c34edf05e91", - "cd1b4794e09dc5d6", - "e557f4efb00ed759", - "ea1ae3fddfd7fae8" - ], - "minimum-moves-to-spread-stones-over-grid": [ - "0750ffaf989a6e95", - "24ead0e47217eb46", - "340748dfdbceb642", - "7667a25f4ca7ce71", - "84d87aee9efc4ae2", - "8f5de59a8191dd5b", - "aaaa1d7d24b6fd40", - "ab1134f87c138033", - "bb2ca379836a8f52", - "bdfd2b218b010afb", - "f00c9b1b197fd759", - "f75621514cfea1a3", - "faafd5a90d8399d3" - ], - "minimum-number-of-keypresses": [ - "b53dc9f393341516" - ], - "minimum-number-of-operations-to-convert-time": [ - "66e4db27adccace7", - "b70dfd1b3adae448", - "f9c8a68c4c8f68eb" - ], - "minimum-number-of-operations-to-make-arrays-similar": [ - "07895b458b8f0172", - "1678c076493330ef", - "1dc61e906cc613bb", - "26056025dcbf432e", - "2ff0ee8828f954a4", - "3af7eeeb59ab791b", - "3beace3f44b96501", - "3d9e3d9626a8add8", - "402e068a4c016cf9", - "402e068a4c016cf9", - "4724520803737275", - "4b43efc0a373ba36", - "4b43efc0a373ba36", - "508dfc82f3ac6340", - "53733bb3b8b8b8cb", - "578193fb6fe445c7", - "58651c88025462d1", - "66595648560c0301", - "6971b5ca395d1812", - "6a05350720674d63", - "7053691a6b0f9855", - "799e287a8321791b", - "7fc01d32db05d1f2", - "85a34061dec835fd", - "85a34061dec835fd", - "8a075a030d39ec1c", - "8bcf49bd6c1415d3", - "9a585b9512ebeb50", - "aa107a3a50a619da", - "aa107a3a50a619da", - "b42ec7e35da8a5a3", - "b6a83d573980f32d", - "b9c89eeb03742691", - "ba4bc3fcabcda99f", - "bc2e56e730240d26", - "c0573a767df3f83e", - "c084bdf3d3030309", - "c3f542e394573233", - "c817b860190055b1", - "ca87f96a37012112", - "d1d4ab2b85fa77ca", - "d4dcbb9006ffc221", - "d4dcbb9006ffc221", - "e28604fbfffa69f9", - "e3517b4a81ee1b09", - "e8fc60708ca60010", - "e98bc0d075a93c86", - "f9afc704a43ad907", - "ffefc0eaec43dae2" - ], - "minimum-number-of-steps-to-make-two-strings-anagram": [ - "6da7000100aae987" - ], - "minimum-number-of-steps-to-make-two-strings-anagram-ii": [ - "d2009ee70a1c07f0" - ], - "minimum-operations-to-make-array-elements-zero": [ - "9bc119fbf156a822", - "a248ebd57ae0e432", - "a248ebd57ae0e432", - "e7c9b1b9fb792562" - ], - "minimum-operations-to-write-the-letter-y-on-a-grid": [ - "69c4f413478923cd", - "e2eeeb6f1e8a8a6b" - ], - "minimum-processing-time": [ - "0734fe7dd5a52f28", - "0b3895d44acd3dc0", - "0fd4b154f145ce62", - "126dab41e6023db8", - "12c1d2a54cd9daae", - "22fa4b44928b3756", - "23f3e6a9d69477a7", - "25aa5a09a4dab7a6", - "279177a04ebfa661", - "2c70eb4ff9e1a501", - "2d71763af4d3f5a9", - "320c55f1b001bfb8", - "3bae25dcbe1cb7ce", - "460305e1899c12a1", - "4948651d69e68c00", - "4e3a1f188d2d8e17", - "51d3d48d41d0a396", - "5424caa024637974", - "681b34f42105dab1", - "6eb1b90090de7f16", - "774489336a3193eb", - "8cfb9df80ac99753", - "8ddf488fd4e26f73", - "918a692cd625be32", - "95d129ba5e77f753", - "9a4fc0da323b33c9", - "9d89dd5c20def4ad", - "9e271354ce07e737", - "a38485de578b8055", - "b3020347042a43bd", - "c7a8e3310545d41a", - "c808e9a8d7ea1849", - "d3065c826b9295b9", - "d45a8aa0137b720a", - "d9914619afe7b2d9", - "d9e2118b6bc40634", - "dd45833c626f29d3", - "f03adcc96f48deb6", - "f7df123f9a2c5e7f", - "fc676d4f739621b1" - ], - "minimum-runes-to-add-to-cast-spell": [ - "c2e74d13a3a5a932" - ], - "minimum-score-triangulation-of-polygon": [ - "e3056c2b57f4e520" - ], - "minimum-total-space-wasted-with-k-resizing-operations": [ - "00460bb2cf742204", - "820e8c4225c18678" - ], - "minimum-xor-sum-of-two-arrays": [ - "4cd05b889f9de2a1" - ], - "most-frequent-number-following-key-in-an-array": [ - "a62b3870025ab9bd" - ], - "movement-of-robots": [ - "172280b9791a3fd0", - "24a8259062826c9d", - "2be6e072c8b849f3", - "2f9f3f7e68c7a7d0", - "897e95af5f0a8694", - "9220ec3b36b8ac16", - "c16c3c29a20012b6", - "d79a7a84e8a95825", - "daf179a849777207" - ], - "nth-magical-number": [ - "76a8b139464eaa20", - "93e306f22a813477", - "9c181fbf4f70d360", - "cdd847fb236c3c40" - ], - "number-of-beautiful-integers-in-the-range": [ - "2367bf856f0e75dc" - ], - "number-of-equivalent-domino-pairs": [ - "dd30fc3b48c3b1f5" - ], - "number-of-single-divisor-triplets": [ - "164baa606d3acf2f", - "1a806c1b82ad8d68", - "1bbee11a17426a59", - "1db780d6a6fd95c3", - "2a978d862eedd49e", - "2d0b22e95d17ddda", - "3787082994d27710", - "41e7059e884c38f8", - "49e47928571e2128", - "517cf72d39cdd608", - "5a207bcbc90328a3", - "5a8a6b41ca3fe0e8", - "6a491d0e647be997", - "6a491d0e647be997", - "6bf0c97f21a8bd35", - "6c89f51d05c52901", - "8c4aeeaf214ea254", - "9063ac310b0ae72e", - "92c041f2c8753bdb", - "9ce3a052148f772f", - "abddad93982f500f", - "abddad93982f500f", - "b240485cf4c82c17", - "b4766caea13dc502", - "b48ba6107f43bd64", - "c0fd27a2e36b9966", - "cb6dcbd223bd8dcc", - "d6302b9ab902f2c4", - "d6302b9ab902f2c4", - "eec4c7c37dcd2c29", - "f145526770f805ee", - "f24c3608240693ed", - "f24c3608240693ed" - ], - "number-of-ways-of-cutting-a-pizza": [ - "812665e177035afa", - "ff31f323b7486f77" - ], - "number-of-ways-to-form-a-target-string-given-a-dictionary": [ - "0eff58ec94425f95", - "1395698abec18f3c", - "1b379df4e3d54256", - "1eb9b24bcf9a76dc", - "1f91253f382739ab", - "23410f0841c524a0", - "2517e43b69ef0a4b", - "269e0d1ea7917534", - "29fbd6334386d812", - "506e36c6df81b91d", - "52a1f3381c66ef5e", - "56204d7909b51cfa", - "64b926f709658745", - "6d86c9d256933e90", - "9a118d74109496d9", - "a2d45539d62e0f8d", - "acdad6a2e39ba584", - "c4b59eaaa2c9e35e", - "cde9e7118a6d180a", - "d06cb1290685d207", - "d556d17825285d27", - "d7092694edce287e", - "dee8de3c01364dea", - "fe307cad149b4179" - ], - "number-of-wonderful-substrings": [ - "451c51b218d646b3", - "a8f42d4ef2087678" - ], - "odd-string-difference": [ - "11967dab02ec41da", - "1772a86a355a8829", - "1c419b5e1296488f", - "3d821e1d23a94bf5", - "3f98b7960a9b79a4", - "44bf73b868862e80", - "518c0bbcf58b4702", - "574cc2cf89e24bba", - "5aa8c10b3f8635b2", - "6fd56cac07d1035c", - "7687000b921d2843", - "78b0558315f75e52", - "7e4aef485ee34aa3", - "87fd44055b1ca246", - "8d93fde6368459ac", - "92b5a1486139fcb9", - "a4f7214fad8cec50", - "aae6e7bfccb07262", - "ad7900bd97a40dbe", - "b10c4e947ef27b46", - "b55668b00138eb6f", - "c2f6ef98252897b7", - "ed1e3e16ddacc07c", - "f05594f193169ba1", - "f7361ad06806ac55", - "fa1529e5243eb2a2" - ], - "optimal-account-balancing": [ - "47ac2b318a549f25", - "4de58c3390331aff", - "8213c5971cc4afc4" - ], - "palindrome-rearrangement-queries": [ - "6c4cca3c077c28ef", - "ec91e331fa9c8849" - ], - "parsing-a-boolean-expression": [ - "47f7180c332cf474", - "680e386d9469691b" - ], - "path-in-zigzag-labelled-binary-tree": [ - "8f5cc3d3dc5cbc1a" - ], - "path-with-maximum-probability": [ - "c666f711d564d67e" - ], - "permutation-difference-between-two-strings": [ - "278420e63f9d94f6", - "29c00617cfd5fca9", - "401a65130cf73721", - "7b0026a3cf1bcfbb", - "a6f82fa1aa62c7cb", - "ba08a5408b3e25a3", - "bfbc6fbbd137f5db", - "c2ad1e55d488f0a0", - "ec2b37c7ca78e747", - "ed5b75cb5e5b1d01" - ], - "preimage-size-of-factorial-zeroes-function": [ - "8f5cc3d3dc5cbc1a" - ], - "pyramid-transition-matrix": [ - "0e10aa49f515313f", - "19c27d88cb99eb85", - "2240191007483c35", - "330e712caa1a7777", - "333c945949dbbf11", - "33d2b55906012956", - "390ce48306c03085", - "406a21e3e47da8c9", - "4ce96fb188c127ef", - "5b6ee88fb8d446b0", - "61a08fa9891c507e", - "7dacdd94602427bc", - "821a0f159ac933f8", - "86379358f890f817", - "8af6e86277d4b1dd", - "8b8647e9db399af0", - "8d1af797ee52128e", - "942ed53ef17efdf5", - "9ad68e86c1d69936", - "9cd3340c6451f470", - "a652b3d3f74c274b", - "a6b722150f1f11a7", - "c6a52bb2f833bf9f", - "c7c30aeed663caf7", - "c9f2953da07809ee", - "cb263f8520bbc55d", - "d42978976076a7c2", - "d4c7704a3fd27826", - "dfe9e5c41195eaed", - "ef74052414c02dca" - ], - "query-kth-smallest-trimmed-number": [ - "0147c7b3a3d7ee20", - "12d4f690e13e8e26", - "3ad7b5f362c26d72", - "423a66f34004f60b", - "5b65ef0a03d97eec", - "a7d4dc0677d03acd", - "b138f8805d8d9a1f", - "e1fb58589db085ec" - ], - "queue-reconstruction-by-height": [ - "0e145b1debe726a2", - "2d63bbd889d46b49", - "32bb34aac72aa499", - "3ad0e66d4ffdf50b", - "62025eca1462ad58", - "62550fa808faebd0", - "65b1643cee9790e9", - "66a27caf3cb0cb2c", - "6958c6d8d748d3a4", - "6b199c88e5bdc1c5", - "76e76a89a0511a4b", - "84bc27b6e0c6c5e9", - "8a1125b49ecc38a7", - "8aa1734cd92942e8", - "8fb85dda77a37aa4", - "998a29ad307a5161", - "9b78e293cdb0b6f4", - "9f01e29fb6e8f988", - "9f320920b44e7d90", - "9fd6555e6fd7c9d9", - "a8e1c41bc33a632a", - "ab64bad60b4556e9", - "b129c091fc67c82f", - "b5b1b47ac533c525", - "c12c7eaba49323be", - "c2bc20b1f3768b24", - "c3374ea3abf50897", - "c9ff3fdedbb9c746", - "cb125bfeec83eb9f", - "d61ff0f0aace3348", - "e20c24e500574c9b", - "f02a72d116af35d1", - "f45501a7cd61b240" - ], - "range-addition": [ - "594278649dfd2416", - "727ec0259ad74189", - "a380fdf0acb8d1d1", - "caddcf470cb29034", - "e3d2ca770eeff83a" - ], - "range-product-queries-of-powers": [ - "03ff71c699aae7ef", - "2126c59495e76c3a", - "2a216f8062b56b1f", - "327634f9ee065c59", - "3c405fe21a2107e5", - "3cb84b626cc37b3a", - "3d41dc3b3480708a", - "48ea4ee890ab2d6b", - "526de68ff6acd09f", - "52c167c7607c3bca", - "54f913740c0245aa", - "57623d3d064debbf", - "5d2257e2eff34bdd", - "6358a21c0b51015f", - "67219e69c12a629d", - "68344ab6353252da", - "6e1b42f1553909e4", - "71326c64a83b39c7", - "7fb41eec41f6eb48", - "8ecd2f18d32bfc57", - "a86bf49539a54af8", - "d034db09abc740dc", - "d66dcf030e1e9e06", - "e157f38d06402058", - "f56bf7fe58061bc7", - "f7536549be409cd8", - "fcb405886387c143" - ], - "range-sum-of-sorted-subarray-sums": [ - "177cd1176882d268", - "177cd1176882d268", - "27596ab463619aa9", - "2edd8719a16553a4", - "370fd2ae3b995cf1", - "3ccfb320236b2acf", - "42380c946a3ab9b7", - "5972b4edb67a7e85", - "5a8391903891d9db", - "650cc89c9911a4a3", - "6cab92fad95eec35", - "775c4f436ad9c10a", - "7f77e79918007796", - "832b81d5f18bfeb5", - "838a638c576c53d3", - "8f19920ca621d31a", - "a34614f5a0a68b7f", - "aa8f3aaff3634ebe", - "ac71578c78f92e6c", - "b41781a00ea66abd", - "c4b5771661fb3779", - "cdd72ad6f95ab85f", - "ce150bcb59a944aa", - "d5ac8518bc3c0fba", - "e975032ee1c96168", - "ed35da94c8c9a018", - "ede6b841072d742a" - ], - "rank-teams-by-votes": [ - "15d23963a4a8652d", - "26edf9b482d5cdfb", - "2f3cefcf01c5be12", - "4aad3fc2c349773a", - "642c79475441970a", - "68e3d1d7c39431d2", - "74800bd72df98990", - "daeecb3ebe08b09e", - "fcf96f19f1dc5a54" - ], - "ransom-note": [ - "c2978107bb31c6a4", - "fcf9602f82c7e758" - ], - "reach-a-number": [ - "777bbfb99b4c6c66" - ], - "rearrange-k-substrings-to-form-target-string": [ - "0dbfb2d557ba3ceb", - "0fb755e23344c41c", - "3fbd732f696b96b5", - "4884dc33fbb4d348", - "4cbb8665b2be42ac", - "57790a5bd2b0d899", - "7e629420fe58b038", - "903f72760cb9083c", - "968d813236056f73", - "b002df53c372c207", - "bbb9f186d9c3cf6d", - "d1efc2b28ab6d1d4" - ], - "rearrange-spaces-between-words": [ - "89d634c685b2c6dc" - ], - "recover-the-original-array": [ - "0a02526c5b35d123", - "72d4f1c0d84739ed", - "e1d3ecd5651869a9" - ], - "remove-all-adjacent-duplicates-in-string-ii": [ - "69ba4b1fae637923" - ], - "remove-all-ones-with-row-and-column-flips-ii": [ - "1bcb889ee836b14c", - "29cb00eecd3b3a54", - "356df3231b57445a", - "4a7f2c8d849fd4e2", - "520493d1ca840afb", - "5d2ab661316164d9", - "5d44975209257531", - "69497d27285fa4cf", - "71ff950cdf0775db", - "7778f6e6b72bf051", - "ccc291893bcae427", - "d322b3514f5f15c4", - "efad6b9c5e1412aa" - ], - "remove-k-digits": [ - "90c7258162c40e5d", - "d67aa0163e9c339d" - ], - "reorganize-string": [ - "c08d64aa1597acd9" - ], - "reschedule-meetings-for-maximum-free-time-i": [ - "2479e7645ee39b1f", - "bc8a9e549865f7ec", - "d38a739966d2da00", - "ef52c190fd908de7", - "f02fb640364564a2" - ], - "restore-the-array-from-adjacent-pairs": [ - "3b84b224b64e88f3" - ], - "select-cells-in-grid-with-maximum-score": [ - "1ad55e46dddafdcb", - "ab74b42a5ad3e781", - "b231da32510a9e93", - "c3f24748a5a73f28" - ], - "selling-pieces-of-wood": [ - "0ae3a0d1f180a97f", - "8ecfc64ea01a4237", - "f6b3019fd058a1be" - ], - "shift-distance-between-two-strings": [ - "507eb29d302f8cea", - "63c617fb663d75c1", - "7477e6ebc1c67fb0", - "7d6065ff44bfb0df", - "b4a5d0689f63bd1f", - "faa2dee7a8de25aa" - ], - "shifting-letters-ii": [ - "6054de6c9e0b01ce" - ], - "shopping-offers": [ - "5310ea5a1a5fcc1c", - "d98faefaf4dbb8e7", - "daac72e5496346eb", - "dde1c4e3240204b2" - ], - "shortest-matching-substring": [ - "54c6bfbc24949cad", - "cbd14d4d4b2d4aa8" - ], - "shortest-path-to-get-all-keys": [ - "4d9cba6bb284ec05", - "5030f0540ea539de", - "5d1e5b8a3bf35ea9", - "944d409bec21b2dc" - ], - "shuffle-the-array": [ - "0f1062f08a07dd57", - "250ad836396d5baf", - "25e4e030843af3ed", - "422b837c82dccde6", - "62c3a2e4645bc2dd", - "77b304d61a63b923", - "8f7808ba9d9bcb25", - "e7cadf6d172625b5" - ], - "single-number-ii": [ - "7e52b3c6539c43c0", - "a8d4e0074a74f340", - "ac0656baa38b7882", - "ea6ad312f623c8e1" - ], - "single-row-keyboard": [ - "38c5876702a407a8", - "421cd01427571834", - "48c69b9634032a81", - "51a518e8bea7267a", - "7e230c910d288f10" - ], - "slowest-key": [ - "5110dcf8afb669fb", - "55f2968de96b9705", - "fecefff602543220" - ], - "smallest-good-base": [ - "20e0158f9c3ed183", - "2e9426b3f47c1297", - "432ed555937f82a4", - "7f4255bd828c55b4", - "b6ec1d21ee96c1cf", - "c08b3f85d65fb3bf", - "c382dee56bed9f1d", - "cdb3896be40787ac", - "d27484f79c172c35", - "d7ea17aa3dea19d7", - "f92e882187ece3ed", - "fb5f3ce990d20552" - ], - "smallest-integer-divisible-by-k": [ - "13d951eacb7a4bb7", - "6906685ea2879092" - ], - "smallest-missing-genetic-value-in-each-subtree": [ - "1857f17f31e55365", - "a87f73d898c8a443", - "e5147a8a0331267a" - ], - "smallest-missing-non-negative-integer-after-operations": [ - "c43657c61ce3262e", - "cb363460aca13e74", - "cb363460aca13e74", - "d572d040b48a19e3", - "e2915e571c3ff578", - "ef988b32c3135cc3" - ], - "smallest-rotation-with-highest-score": [ - "79778b8329a78525", - "934b082015a31cf0", - "966100e371be0815", - "99fd2cbc8afff2f9" - ], - "smallest-string-with-a-given-numeric-value": [ - "1ed04aab62515327", - "458537e4b4c0c7fa", - "5aff7a09c2c90f4a", - "7a10ffd3037e5048" - ], - "smallest-subsequence-of-distinct-characters": [ - "73d34cdcf5b042a7" - ], - "solve-the-equation": [ - "0e9c6ad8ffe770c4", - "2375c3e703b51648", - "5b129848cfcb187a", - "5d31bbe45fbe2456", - "6052f5b91592c24f", - "6a2ae69fcd82975c", - "88a0476b2edbfc73", - "988f402c08fd5667", - "c4d35b01bbf7a1c5", - "cab3cf0c81afbb9b", - "d1df8550efa22fca", - "e489e58ab0bf6cdd", - "eb943e9c290f9a72" - ], - "sort-integers-by-the-number-of-1-bits": [ - "36e3a41ea3745ae1", - "a31f084a6762173a", - "bf2b7c01cdc65691", - "ca9446d84ad0098b", - "d066c9d1784be654", - "d3ee483bb2edea94" - ], - "sorting-the-sentence": [ - "119b2c9f765cdd6c", - "28abe2e640b952cd", - "6cca0e14decc516a", - "b1fd0b5c856f8d27", - "be7a834467d7b558" - ], - "split-the-array": [ - "55828a3ebad8a363" - ], - "split-two-strings-to-make-palindrome": [ - "3a7f210eb424616b" - ], - "string-transforms-into-another-string": [ - "2abecc3a5935ef8d", - "5883ca6aea4397bb", - "5b7a3b6f6e054437", - "fbf00096f737eaa7" - ], - "subarray-product-less-than-k": [ - "29273957ac59ce32", - "c0bc2438c04edb49", - "f07d7f68ac1a8d41" - ], - "subarrays-with-k-different-integers": [ - "327d4cde4642aedc", - "5fc756e4d5e5aabf", - "738a112ff2df61b8", - "ac9780eb5e9b2467", - "c5680d3e71167ff3" - ], - "sum-in-a-matrix": [ - "62b43484f3ec573a" - ], - "sum-of-good-subsequences": [ - "80da361819220d92", - "9684d3356eda55f9" - ], - "sum-of-remoteness-of-all-cells": [ - "07b0fca396ba8074" - ], - "sum-of-unique-elements": [ - "229d3637f75c0340" - ], - "super-palindromes": [ - "0950378e9c45d075", - "102a0cb352a7ed76", - "15e3e1929ae0e1b3", - "4bd38d5f9cabe435", - "55da4761e87efbab", - "6670363b055c93ae", - "82f232d094b62305", - "fbba87718081496a" - ], - "surface-area-of-3d-shapes": [ - "2579dbca405f4abd", - "a3515fe5386fa0c4", - "de4fc5c757774651" - ], - "swim-in-rising-water": [ - "414b449c929b34c6", - "808aaaef11a28c2f" - ], - "tallest-billboard": [ - "d9531eeab4e6acb6" - ], - "text-justification": [ - "4b3a18588be60e48", - "96a5ac74cf9c3add", - "ae3408cf1496962a", - "d3f474d61d2b2ce2", - "e427bc52130be0bc" - ], - "the-k-weakest-rows-in-a-matrix": [ - "6c40f14adc4d9e04" - ], - "the-number-of-beautiful-subsets": [ - "0c244a204d2767b2", - "0c244a204d2767b2", - "18ae07e2c5a25180", - "6288375b2234a5fe", - "c53478d8969d86f4", - "e8c4b7bb62eb15b5", - "f98923250544383f" - ], - "the-score-of-students-solving-math-expression": [ - "3d0418fec5de94e0", - "3e860cc46f179d6d", - "ebc69c1d2d287268" - ], - "the-skyline-problem": [ - "338bddb43de119d5", - "b6540cb7f713e721" - ], - "the-two-sneaky-numbers-of-digitville": [ - "0039cd28914b9b4c", - "31151442dd489809", - "4e451e144bf671c4", - "73a269f6971a6935", - "973b82e96504d67b", - "c1736272eecc84d7" - ], - "top-k-frequent-elements": [ - "045e53f3052ebc98", - "141c696b3adc1a31", - "334b4da5f8008f76", - "41c6319590b72568", - "55a8b9d9be84953c", - "66a8df66b177b35f", - "7dce357e3665c48e", - "8fa6358caf9519e4", - "971bb86a40b652c4", - "a5611de835a32ec5", - "f34d9e865fb49ffd" - ], - "total-characters-in-string-after-transformations-ii": [ - "233e46b4a544281c", - "7308587f6337c9ef", - "9267e82951c2c29d", - "c046f0a1b6671d10", - "fe3b171dd02d105e" - ], - "tree-of-coprimes": [ - "09cf6dd3364c4ac2", - "38359dfbd5585c5d", - "3d7a7f42eb303190", - "568f9f3a1969c910", - "74432cbb63f8da94", - "82135de05d7138b9", - "a40589e8cfb3e1dd", - "d64d669d329e07d2" - ], - "truncate-sentence": [ - "45243c866b9825f7", - "5f64474f56c1109c" - ], - "tuple-with-same-product": [ - "1221c3e79370480b", - "22d162feffb65b62", - "5b2aab527d591d63" - ], - "two-furthest-houses-with-different-colors": [ - "90b6cb52d7fa6f51" - ], - "two-out-of-three": [ - "394f9b3fd60fcb07" - ], - "verifying-an-alien-dictionary": [ - "3ce6e99bf3f83090", - "63c7a7a504c252b0", - "6574a41a9623530d", - "b56b2fcc822e6d85", - "dd023f2b62cac8c3" - ], - "widest-pair-of-indices-with-equal-range-sum": [ - "28f38872433ecfa6", - "96c10d4dbcfd7396", - "9b2f47d1510bdc8f", - "bb2ced683f4f4c8b" - ], - "words-within-two-edits-of-dictionary": [ - "0bdc514a846bd7a9", - "22647f9a6a0112b9", - "232a94557543168f", - "a8e8f1851f206d0d", - "f2b5fa4a8eca789b" - ] +"01-matrix": [], +"1-bit-and-2-bit-characters": [], +"132-pattern": [], +"2-keys-keyboard": [], +"24-game": [], +"3sum": [], +"3sum-closest": [], +"3sum-smaller": [], +"3sum-with-multiplicity": [ +"90eee1e5a5007d5b", +"935d03fea778aaf7" +], +"4-keys-keyboard": [], +"4sum": [], +"4sum-ii": [], +"a-number-after-a-double-reversal": [], +"abbreviating-the-product-of-a-range": [], +"account-balance-after-rounded-purchase": [], +"accounts-merge": [], +"add-binary": [], +"add-bold-tag-in-string": [], +"add-digits": [], +"add-edges-to-make-degrees-of-all-nodes-even": [], +"add-minimum-number-of-rungs": [], +"add-one-row-to-tree": [], +"add-strings": [], +"add-to-array-form-of-integer": [], +"add-two-integers": [], +"add-two-numbers": [], +"add-two-numbers-ii": [], +"adding-spaces-to-a-string": [], +"adding-two-negabinary-numbers": [], +"additive-number": [], +"adjacent-increasing-subarrays-detection-i": [], +"adjacent-increasing-subarrays-detection-ii": [], +"advantage-shuffle": [ +"78a955c43eb2f05b" +], +"airplane-seat-assignment-probability": [], +"alert-using-same-key-card-three-or-more-times-in-a-one-hour-period": [ +"9465eb1072e5cf12" +], +"alice-and-bob-playing-flower-game": [], +"alien-dictionary": [], +"all-ancestors-of-a-node-in-a-directed-acyclic-graph": [], +"all-divisions-with-the-highest-score-of-a-binary-array": [], +"all-elements-in-two-binary-search-trees": [], +"all-paths-from-source-lead-to-destination": [], +"all-paths-from-source-to-target": [], +"allocate-mailboxes": [], +"alphabet-board-path": [ +"3cc43fff2c266151" +], +"alt-and-tab-simulation": [ +"f751436941b007d6" +], +"alternating-digit-sum": [], +"alternating-groups-i": [], +"alternating-groups-ii": [], +"ambiguous-coordinates": [], +"amount-of-new-area-painted-each-day": [], +"amount-of-time-for-binary-tree-to-be-infected": [], +"android-unlock-patterns": [], +"angle-between-hands-of-a-clock": [], +"ant-on-the-boundary": [], +"append-characters-to-string-to-make-subsequence": [], +"append-k-integers-with-minimal-sum": [], +"apple-redistribution-into-boxes": [], +"apply-bitwise-operations-to-make-strings-equal": [], +"apply-discount-to-prices": [ +"aeb8fb56533e74b7" +], +"apply-operations-on-array-to-maximize-sum-of-squares": [], +"apply-operations-to-an-array": [], +"apply-operations-to-make-all-array-elements-equal-to-zero": [], +"apply-operations-to-make-string-empty": [], +"apply-operations-to-make-sum-of-array-greater-than-or-equal-to-k": [], +"apply-operations-to-make-two-strings-equal": [], +"apply-operations-to-maximize-frequency-score": [], +"apply-substitutions": [], +"arithmetic-slices": [], +"arithmetic-slices-ii-subsequence": [], +"arithmetic-subarrays": [ +"0d2a95b882da2eb3", +"c4be070e9d944f47", +"d9abb398dc14c52f" +], +"armstrong-number": [], +"arranging-coins": [], +"array-nesting": [], +"array-of-doubled-pairs": [], +"array-partition": [], +"array-transformation": [], +"array-with-elements-not-equal-to-average-of-neighbors": [ +"b1380582817112b8" +], +"as-far-from-land-as-possible": [], +"assign-cookies": [], +"assign-elements-to-groups-with-constraints": [], +"asteroid-collision": [], +"available-captures-for-rook": [], +"average-height-of-buildings-in-each-segment": [], +"average-of-levels-in-binary-tree": [], +"average-salary-excluding-the-minimum-and-maximum-salary": [ +"426a7dc83b5aff54", +"66b83abf25bc3f40" +], +"average-value-of-even-numbers-that-are-divisible-by-three": [], +"average-waiting-time": [], +"avoid-flood-in-the-city": [], +"backspace-string-compare": [], +"bag-of-tokens": [], +"balance-a-binary-search-tree": [ +"0070eb719fb14a64", +"03a5b668129b22fc", +"074336a597f39c98", +"07bcfe0a288ed978", +"0ff59e8a35bc6120", +"10261a05ddeb96fc", +"182ff96eb879c3f5", +"1f7cad3df6380438", +"26fc73ad02c1564d", +"27079b4ccd9cfe2f", +"282f8bcfd80bd426", +"332308892280de11", +"3695ad711957c627", +"36b917111e00c7fe", +"38300474bd3736b3", +"4975a23d156da894", +"4ce70110c38b80b5", +"53ff14a82e1e9e9e", +"58348788e1f51fb9", +"5a6a86bb89c97988", +"5bda5415ae469563", +"5d2cecc948bb59fc", +"5fd48594f8d78d6b", +"65f1759e1ca3be51", +"7837082b05cd2acd", +"7a7df1094b68ce3a", +"7c89b79aafae5b10", +"7d185ae3868ad10f", +"7e777d56c0c8df44", +"83cefaa1539657f2", +"9aec6164898cee74", +"9f9aa13e46c2332b", +"a7f1a9b593b19eeb", +"b1e1d18b46940379", +"c0bada229f3da67b", +"c55718dc10d188f9", +"c92e5d50089b8847", +"e5ac2b27f3171f8f", +"e5ade2271ea29132", +"e63bf9e11c3d58f1", +"ea40e2b15b16d867", +"f12a7593281ed80d", +"fe6c0e65a7989e43" +], +"balanced-binary-tree": [], +"base-7": [], +"baseball-game": [], +"basic-calculator": [], +"basic-calculator-ii": [ +"14cbf4720c9b07ab", +"2410377ec0642512", +"3684b89944935610", +"5a9aa5e50870d97c", +"d0805c29d48b0496", +"ea11dfededdd315a" +], +"basic-calculator-iii": [], +"basic-calculator-iv": [], +"battleships-in-a-board": [], +"beautiful-arrangement": [], +"beautiful-arrangement-ii": [], +"beautiful-array": [], +"beautiful-pairs": [], +"beautiful-towers-i": [], +"beautiful-towers-ii": [], +"before-and-after-puzzle": [], +"best-meeting-point": [], +"best-poker-hand": [], +"best-position-for-a-service-centre": [], +"best-sightseeing-pair": [], +"best-team-with-no-conflicts": [], +"best-time-to-buy-and-sell-stock": [], +"best-time-to-buy-and-sell-stock-ii": [], +"best-time-to-buy-and-sell-stock-iii": [], +"best-time-to-buy-and-sell-stock-iv": [], +"best-time-to-buy-and-sell-stock-with-cooldown": [], +"best-time-to-buy-and-sell-stock-with-transaction-fee": [], +"better-compression-of-string": [], +"binary-gap": [], +"binary-number-with-alternating-bits": [], +"binary-prefix-divisible-by-5": [], +"binary-search": [], +"binary-search-tree-to-greater-sum-tree": [], +"binary-searchable-numbers-in-an-unsorted-array": [], +"binary-string-with-substrings-representing-1-to-n": [], +"binary-subarrays-with-sum": [], +"binary-tree-cameras": [], +"binary-tree-coloring-game": [], +"binary-tree-inorder-traversal": [], +"binary-tree-level-order-traversal": [], +"binary-tree-level-order-traversal-ii": [], +"binary-tree-longest-consecutive-sequence": [], +"binary-tree-longest-consecutive-sequence-ii": [], +"binary-tree-maximum-path-sum": [], +"binary-tree-paths": [], +"binary-tree-postorder-traversal": [], +"binary-tree-preorder-traversal": [], +"binary-tree-pruning": [], +"binary-tree-right-side-view": [], +"binary-tree-tilt": [], +"binary-tree-upside-down": [], +"binary-tree-vertical-order-traversal": [ +"2bdc4bcdac3c1b94", +"85c8c50191091863" +], +"binary-tree-zigzag-level-order-traversal": [], +"binary-trees-with-factors": [], +"binary-watch": [], +"bitwise-and-of-numbers-range": [], +"bitwise-or-of-adjacent-elements": [], +"bitwise-or-of-all-subsequence-sums": [], +"bitwise-ors-of-subarrays": [], +"bitwise-xor-of-all-pairings": [], +"block-placement-queries": [], +"boats-to-save-people": [], +"bold-words-in-string": [], +"bomb-enemy": [], +"boundary-of-binary-tree": [], +"brace-expansion": [], +"brace-expansion-ii": [ +"549add7b664f8da7", +"fc2c05a79c0da646" +], +"break-a-palindrome": [], +"brick-wall": [], +"bricks-falling-when-hit": [], +"brightest-position-on-street": [], +"broken-calculator": [], +"buddy-strings": [], +"build-a-matrix-with-conditions": [], +"build-an-array-with-stack-operations": [], +"build-array-from-permutation": [], +"build-array-where-you-can-find-the-maximum-exactly-k-comparisons": [], +"building-boxes": [], +"buildings-with-an-ocean-view": [], +"bulb-switcher": [], +"bulb-switcher-ii": [], +"bulls-and-cows": [], +"burst-balloons": [], +"bus-routes": [], +"button-with-longest-push-time": [], +"buy-two-chocolates": [], +"calculate-amount-paid-in-taxes": [], +"calculate-delayed-arrival-time": [], +"calculate-digit-sum-of-a-string": [], +"calculate-money-in-leetcode-bank": [], +"camelcase-matching": [], +"campus-bikes": [], +"campus-bikes-ii": [], +"can-convert-string-in-k-moves": [], +"can-i-win": [], +"can-make-arithmetic-progression-from-sequence": [], +"can-make-palindrome-from-substring": [], +"can-place-flowers": [], +"can-you-eat-your-favorite-candy-on-your-favorite-day": [], +"candy": [], +"candy-crush": [], +"capacity-to-ship-packages-within-d-days": [], +"capitalize-the-title": [ +"ab50dc7a79916e4d" +], +"car-fleet": [], +"car-fleet-ii": [ +"ca25b90f45d516b8" +], +"car-pooling": [ +"c6f32eca46b8fea5" +], +"card-flipping-game": [], +"cat-and-mouse": [], +"cat-and-mouse-ii": [], +"categorize-box-according-to-criteria": [], +"cells-in-a-range-on-an-excel-sheet": [ +"00f3d5da282f5973", +"049fb0fba71e5649", +"07b50fb8acbea7c3", +"0a5bfb02a31be7d9", +"0d2af3cd0aaf2f55", +"10e4f6f78bfb834c", +"182b1a3135174a26", +"1dd6bbde176be96f", +"1f0748401f1e0d35", +"2ab0037244e5028a", +"2e772ce53a1d1710", +"355034257d3210c8", +"36f9acde35647d68", +"3db50992ae2ce294", +"406cc4cb54b834f0", +"432739a1d328cc9c", +"433b85f35ceaa0c5", +"441a4fbeea6008e6", +"53b196c28f63ff8c", +"5750d005f587e42f", +"5d2afe70dde5005c", +"5f899ae724b29ef1", +"63b9510f7314e33e", +"6fe802743a75cd81", +"76c5f019f63019b9", +"85a29ab3768bd82e", +"8fb7d90ad3d2861c", +"90e4da20f2526fa4", +"918e3d523db798d2", +"9823ca4c7fb23c3c", +"9941e1258fb0189e", +"a1a1a693fa9b8c43", +"a5658b9d546b9aee", +"a806830fcec7aa14", +"aa5698a7601c6a5d", +"ab082eac82fe7876", +"b063a4ae2b7eb60b", +"b0f5d2dbaed77e25", +"b6ba743147130f28", +"b92b1b3729d72bf6", +"d64e0cc3df07e5d8", +"da03c720cd8a6777", +"dd314f898c9f5564", +"dd48d6aaf5525c09", +"eba18540c47df807", +"ec4d67686899dda7", +"f817fc85e4f345a0", +"f89608a64e5f21da", +"fa0872dc7dd74fc4", +"fdcfcd427e5a9296" +], +"cells-with-odd-values-in-a-matrix": [], +"chalkboard-xor-game": [], +"champagne-tower": [], +"change-minimum-characters-to-satisfy-one-of-three-conditions": [], +"cheapest-flights-within-k-stops": [], +"check-array-formation-through-concatenation": [], +"check-balanced-string": [], +"check-completeness-of-a-binary-tree": [], +"check-distances-between-same-letters": [], +"check-for-contradictions-in-equations": [], +"check-if-a-number-is-majority-element-in-a-sorted-array": [], +"check-if-a-parentheses-string-can-be-valid": [], +"check-if-a-string-can-break-another-string": [ +"315d77149f389bb7", +"329d24ecdaa57a80", +"49c5774aa1597c0f", +"e683f3e27fbf8a6d" +], +"check-if-a-string-contains-all-binary-codes-of-size-k": [], +"check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree": [], +"check-if-a-string-is-an-acronym-of-words": [], +"check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence": [], +"check-if-all-1s-are-at-least-length-k-places-away": [], +"check-if-all-as-appears-before-all-bs": [], +"check-if-all-characters-have-equal-number-of-occurrences": [ +"665f66b0cf05eb7f" +], +"check-if-all-the-integers-in-a-range-are-covered": [], +"check-if-an-array-is-consecutive": [], +"check-if-an-original-string-exists-given-two-encoded-strings": [], +"check-if-array-is-good": [], +"check-if-array-is-sorted-and-rotated": [], +"check-if-array-pairs-are-divisible-by-k": [], +"check-if-binary-string-has-at-most-one-segment-of-ones": [], +"check-if-bitwise-or-has-trailing-zeros": [], +"check-if-dfs-strings-are-palindromes": [], +"check-if-digits-are-equal-in-string-after-operations-i": [], +"check-if-digits-are-equal-in-string-after-operations-ii": [], +"check-if-every-row-and-column-contains-all-numbers": [ +"9b37b577259e73a7", +"ca8f6f2202eb96b0", +"ddd3743ca4afc9b6", +"f76639c9206ce6b1" +], +"check-if-grid-can-be-cut-into-sections": [], +"check-if-grid-satisfies-conditions": [], +"check-if-it-is-a-good-array": [], +"check-if-it-is-a-straight-line": [], +"check-if-it-is-possible-to-split-array": [], +"check-if-matrix-is-x-matrix": [], +"check-if-move-is-legal": [], +"check-if-n-and-its-double-exist": [], +"check-if-number-has-equal-digit-count-and-digit-value": [], +"check-if-number-is-a-sum-of-powers-of-three": [], +"check-if-numbers-are-ascending-in-a-sentence": [], +"check-if-one-string-swap-can-make-strings-equal": [], +"check-if-point-is-reachable": [], +"check-if-string-is-a-prefix-of-array": [], +"check-if-string-is-decomposable-into-value-equal-substrings": [], +"check-if-string-is-transformable-with-substring-sort-operations": [], +"check-if-strings-can-be-made-equal-with-operations-i": [], +"check-if-strings-can-be-made-equal-with-operations-ii": [ +"556f9a43c896c5c6", +"587b13fb9d238ec3", +"5f1f5c99ea7a4df2", +"6053a575946fb54c", +"796002d0af7577f5", +"83aeb648c8feb026", +"8ddce063946cc7ae", +"aa7a0d00e283efa2", +"b5094be8f4f02699", +"d03819281334dfd6", +"d09d9d9f3f2b2950" +], +"check-if-the-number-is-fascinating": [], +"check-if-the-rectangle-corner-is-reachable": [], +"check-if-the-sentence-is-pangram": [ +"98c98b57f409a5b7" +], +"check-if-there-is-a-path-with-equal-number-of-0s-and-1s": [], +"check-if-there-is-a-valid-parentheses-string-path": [], +"check-if-there-is-a-valid-partition-for-the-array": [], +"check-if-there-is-a-valid-path-in-a-grid": [], +"check-if-two-chessboard-squares-have-the-same-color": [], +"check-if-two-string-arrays-are-equivalent": [], +"check-if-word-can-be-placed-in-crossword": [], +"check-if-word-equals-summation-of-two-words": [], +"check-if-word-is-valid-after-substitutions": [], +"check-knight-tour-configuration": [], +"check-whether-two-strings-are-almost-equivalent": [ +"136b43b401a668d2", +"80001f2cb5279f98", +"c1bf9a5eede525e8" +], +"checking-existence-of-edge-length-limited-paths": [], +"cherry-pickup": [], +"cherry-pickup-ii": [], +"choose-edges-to-maximize-score-in-a-tree": [ +"02652f58fb194d40", +"04ad1878bf832be4", +"4353dbc969629e39", +"55dd01ff574182dc", +"7ca814d4f044561b", +"aa76a73a388204d0", +"cfcde26ecbddc923", +"e8caa7128c8d3eaa" +], +"choose-k-elements-with-maximum-sum": [], +"choose-numbers-from-two-arrays-in-range": [], +"cinema-seat-allocation": [], +"circle-and-rectangle-overlapping": [], +"circular-array-loop": [], +"circular-permutation-in-binary-representation": [], +"circular-sentence": [], +"clear-digits": [], +"climbing-stairs": [], +"closest-binary-search-tree-value": [], +"closest-binary-search-tree-value-ii": [], +"closest-dessert-cost": [], +"closest-divisors": [ +"8f5cc3d3dc5cbc1a" +], +"closest-equal-element-queries": [], +"closest-fair-integer": [], +"closest-leaf-in-a-binary-tree": [], +"closest-node-to-path-in-tree": [], +"closest-nodes-queries-in-a-binary-search-tree": [], +"closest-prime-numbers-in-range": [], +"closest-room": [], +"closest-subsequence-sum": [ +"a4a162cfe1fa86c5", +"e984c885ea6dcc16" +], +"clumsy-factorial": [], +"coin-change": [], +"coin-change-ii": [], +"coin-path": [], +"collect-coins-in-a-tree": [ +"7decb78320ebba0c", +"a41486e69a41adc9", +"ad6a8209feac5f65", +"b5fa397d7bd413d8", +"cd5390ea18b2efbc", +"e85bf5528ad9417c" +], +"collecting-chocolates": [], +"color-the-triangle-red": [], +"coloring-a-border": [], +"combination-sum": [], +"combination-sum-ii": [], +"combination-sum-iii": [], +"combination-sum-iv": [], +"combinations": [], +"compare-strings-by-frequency-of-the-smallest-character": [ +"fd5d67bc3232cb77" +], +"compare-version-numbers": [], +"complement-of-base-10-integer": [], +"complex-number-multiplication": [], +"concatenated-words": [], +"concatenation-of-array": [], +"concatenation-of-consecutive-binary-numbers": [], +"confusing-number": [], +"confusing-number-ii": [], +"connecting-cities-with-minimum-cost": [], +"consecutive-characters": [], +"consecutive-numbers-sum": [ +"8f5cc3d3dc5cbc1a" +], +"constrained-subsequence-sum": [], +"construct-2d-grid-matching-graph-layout": [ +"0ab7bcbd5ab10aa7", +"0b6337d1dd91fb9f", +"3f3a7292d53d10d2", +"62f13e324aec8add", +"69f3ca8739fd35ca", +"6adb171400d6de48", +"7dd551118a7a7b0c", +"7f1ac80346a0af42", +"8450213df4820747", +"8b239ac9b7ff1743", +"97b2a06eadc9afa5", +"9d4430162de80839", +"9e444983179dcd5e", +"a195f04b8fdbe3b5", +"ac170efd3d35e101", +"ad0f9b3167281864", +"b6900c20d08ed2e2", +"ba1ff75e330e6858", +"bfd901b81b4ebfde", +"c7fba8a30c174a4e", +"d290a61794c52c18", +"db6ece52ffe53711", +"ddcccaab4e403439", +"e2fd01ce2499423b", +"e5bacb0b58ad8f6c", +"eaf325f7e59559ba", +"fc07a2907507543f" +], +"construct-binary-search-tree-from-preorder-traversal": [], +"construct-binary-tree-from-inorder-and-postorder-traversal": [], +"construct-binary-tree-from-preorder-and-inorder-traversal": [], +"construct-binary-tree-from-preorder-and-postorder-traversal": [ +"143297f1aecd6592", +"96339ce5f9338812", +"aa9186c2bc4744d7" +], +"construct-binary-tree-from-string": [], +"construct-k-palindrome-strings": [], +"construct-product-matrix": [], +"construct-smallest-number-from-di-string": [], +"construct-string-from-binary-tree": [], +"construct-string-with-minimum-cost": [ +"82656a20e0d91cb4" +], +"construct-string-with-minimum-cost-easy": [], +"construct-string-with-repeat-limit": [], +"construct-target-array-with-multiple-sums": [ +"e87c1970e8e58b6d" +], +"construct-the-lexicographically-largest-valid-sequence": [], +"construct-the-longest-new-string": [], +"construct-the-minimum-bitwise-array-i": [], +"construct-the-minimum-bitwise-array-ii": [], +"construct-the-rectangle": [], +"constructing-two-increasing-arrays": [], +"contain-virus": [], +"container-with-most-water": [], +"contains-duplicate": [], +"contains-duplicate-ii": [], +"contains-duplicate-iii": [], +"contiguous-array": [], +"continuous-subarray-sum": [], +"continuous-subarrays": [], +"convert-1d-array-into-2d-array": [], +"convert-a-number-to-hexadecimal": [], +"convert-an-array-into-a-2d-array-with-conditions": [ +"1519e7ae039d5324", +"4358e3f1ba0ba889", +"530fab5706b65f54", +"8c14822cf1fe36e7", +"b213f87fd6cfcff3", +"ba5b19310bad72c4", +"c00ba36e1c295c78", +"cb78ac63eeb8e399", +"d261c424463dafe1", +"f1ee20fdbad7e832" +], +"convert-binary-number-in-a-linked-list-to-integer": [], +"convert-bst-to-greater-tree": [], +"convert-date-to-binary": [], +"convert-integer-to-the-sum-of-two-no-zero-integers": [], +"convert-sorted-array-to-binary-search-tree": [], +"convert-sorted-list-to-binary-search-tree": [], +"convert-the-temperature": [], +"convert-to-base-2": [], +"convex-polygon": [], +"coordinate-with-maximum-network-quality": [], +"corporate-flight-bookings": [], +"count-all-possible-routes": [], +"count-all-valid-pickup-and-delivery-options": [], +"count-almost-equal-pairs-i": [], +"count-almost-equal-pairs-ii": [], +"count-alternating-subarrays": [], +"count-and-say": [], +"count-array-pairs-divisible-by-k": [], +"count-artifacts-that-can-be-extracted": [], +"count-asterisks": [], +"count-beautiful-numbers": [], +"count-beautiful-splits-in-an-array": [], +"count-beautiful-substrings-i": [], +"count-beautiful-substrings-ii": [], +"count-binary-substrings": [], +"count-collisions-on-a-road": [], +"count-common-words-with-one-occurrence": [], +"count-complete-subarrays-in-an-array": [], +"count-complete-substrings": [], +"count-complete-tree-nodes": [], +"count-connected-components-in-lcm-graph": [], +"count-days-spent-together": [], +"count-days-without-meetings": [], +"count-different-palindromic-subsequences": [], +"count-distinct-numbers-on-board": [], +"count-elements-with-maximum-frequency": [], +"count-elements-with-strictly-smaller-and-greater-elements": [], +"count-equal-and-divisible-pairs-in-an-array": [], +"count-fertile-pyramids-in-a-land": [], +"count-good-meals": [], +"count-good-nodes-in-binary-tree": [], +"count-good-numbers": [], +"count-good-triplets": [], +"count-good-triplets-in-an-array": [], +"count-hills-and-valleys-in-an-array": [], +"count-increasing-quadruplets": [], +"count-integers-with-even-digit-sum": [], +"count-items-matching-a-rule": [], +"count-k-reducible-numbers-less-than-n": [], +"count-largest-group": [], +"count-lattice-points-inside-a-circle": [], +"count-mentions-per-user": [], +"count-negative-numbers-in-a-sorted-matrix": [], +"count-nice-pairs-in-an-array": [], +"count-nodes-equal-to-average-of-subtree": [], +"count-nodes-equal-to-sum-of-descendants": [], +"count-nodes-that-are-great-enough": [], +"count-nodes-with-the-highest-score": [], +"count-non-decreasing-subarrays-after-k-operations": [], +"count-number-of-bad-pairs": [], +"count-number-of-balanced-permutations": [], +"count-number-of-distinct-integers-after-reverse-operations": [], +"count-number-of-homogenous-substrings": [], +"count-number-of-maximum-bitwise-or-subsets": [], +"count-number-of-nice-subarrays": [], +"count-number-of-pairs-with-absolute-difference-k": [], +"count-number-of-possible-root-nodes": [], +"count-number-of-rectangles-containing-each-point": [ +"05fcff06b473a3a1", +"b81fecf52e44c42d", +"ee437cbb16dba5d0" +], +"count-number-of-special-subsequences": [], +"count-number-of-teams": [], +"count-number-of-texts": [], +"count-number-of-ways-to-place-houses": [], +"count-numbers-with-unique-digits": [], +"count-numbers-with-unique-digits-ii": [], +"count-odd-numbers-in-an-interval-range": [], +"count-of-integers": [ +"0402ac1e5d56b939", +"08055afbac4388ed", +"082582c206236b6c", +"08cb5aed1a43bbf6", +"0d4352a6dd704d0d", +"0db030967bc850ff", +"12f882010ee8a80f", +"1ded9821a025a2f3", +"23107a9d40927a50", +"232833b1dde0eb6f", +"250b32c3196b4728", +"27c8451cf6ba9b62", +"2a0235601c1eb817", +"2aa2981475dadab5", +"3dc4b25d25d9eaec", +"42e9883856348f24", +"42fcc99b19662218", +"4506ef3f6c4f33a9", +"4563b93a908a18e7", +"46e804ba93cc87f2", +"46ef2ad2366b3038", +"4a0851f45152fe63", +"539dd197c3ea4070", +"571e124be76de7b6", +"61b94f50a0ac3961", +"63fc74dade659252", +"6501e9d4a57ec964", +"65c2de11d13e9aeb", +"6ed5344810d917e0", +"76f1659c3a594d03", +"78dedbb9b8d1ad21", +"7c5319b11dccbd12", +"7e70ac7bfac9493c", +"7fe6ea519ebd1ef0", +"85649d14a2a9a024", +"8a4557ebb8dd57c7", +"9b8f0339d53ac71e", +"9cd4790fc670e67b", +"a116cf6c10757665", +"a4ad70f2852afe0d", +"a73e8e29014547f2", +"a827340e32c9777f", +"aafaf5918a617d90", +"ad513f2d26971f1f", +"b4936634316c7fa3", +"b9114868f73c4c27", +"ba99b73a52b395c1", +"be447c516c552dac", +"c3ce9e3b733de2d4", +"c45a51ff836a5f5a", +"c4b4eaee409ca848", +"c4d51724e95672ea", +"c60071650b0ac0b9", +"c76a957706659077", +"c9c4469e39ff24d1", +"cf9abab1e922969c", +"d3f59b20eb21156c", +"d54f60afc33c2b2e", +"d6e9b05d8e52debe", +"dc12050c72b7edbd", +"dd8f058472769744", +"de151576fbf99fac", +"df55ea18b136c3c5", +"df63c51bc18a6f2d", +"e6841dd9224947d8", +"ec2b4f19b2715561", +"f4e70c00159b61cd", +"f899f534c214caa5", +"f8e75272980f8d65", +"fba0c41bc8d5216c", +"ff0177bea60ab302" +], +"count-of-interesting-subarrays": [], +"count-of-matches-in-tournament": [], +"count-of-range-sum": [], +"count-of-smaller-numbers-after-self": [], +"count-of-sub-multisets-with-bounded-sum": [ +"50919f7954c535d5", +"74579c83d5f1ef02", +"f76665992e932fb0" +], +"count-of-substrings-containing-every-vowel-and-k-consonants-i": [], +"count-of-substrings-containing-every-vowel-and-k-consonants-ii": [], +"count-operations-to-obtain-zero": [], +"count-pairs-in-two-arrays": [], +"count-pairs-of-connectable-servers-in-a-weighted-tree-network": [], +"count-pairs-of-equal-substrings-with-minimum-difference": [], +"count-pairs-of-nodes": [], +"count-pairs-of-points-with-distance-k": [], +"count-pairs-of-similar-strings": [], +"count-pairs-that-form-a-complete-day-i": [], +"count-pairs-that-form-a-complete-day-ii": [], +"count-pairs-whose-sum-is-less-than-target": [], +"count-pairs-with-xor-in-a-range": [], +"count-palindromic-subsequences": [], +"count-partitions-with-even-sum-difference": [], +"count-paths-that-can-form-a-palindrome-in-a-tree": [], +"count-paths-with-the-given-xor-value": [], +"count-positions-on-street-with-required-brightness": [ +"5f89bc554ae523ca", +"ce81503746a180ee", +"db26474362886dd3" +], +"count-prefix-and-suffix-pairs-i": [], +"count-prefix-and-suffix-pairs-ii": [], +"count-prefixes-of-a-given-string": [], +"count-primes": [], +"count-servers-that-communicate": [], +"count-sorted-vowel-strings": [], +"count-special-integers": [], +"count-special-quadruplets": [], +"count-special-subsequences": [ +"86f741d4aa809f08" +], +"count-square-submatrices-with-all-ones": [], +"count-square-sum-triples": [], +"count-stepping-numbers-in-range": [], +"count-strictly-increasing-subarrays": [], +"count-sub-islands": [], +"count-subarrays-of-length-three-with-a-condition": [], +"count-subarrays-where-max-element-appears-at-least-k-times": [], +"count-subarrays-with-fixed-bounds": [], +"count-subarrays-with-median-k": [], +"count-subarrays-with-more-ones-than-zeros": [], +"count-subarrays-with-score-less-than-k": [], +"count-submatrices-with-all-ones": [], +"count-submatrices-with-equal-frequency-of-x-and-y": [], +"count-submatrices-with-top-left-element-and-sum-less-than-k": [], +"count-substrings-divisible-by-last-digit": [], +"count-substrings-starting-and-ending-with-given-character": [], +"count-substrings-that-can-be-rearranged-to-contain-a-string-i": [ +"1a61b9e471770461" +], +"count-substrings-that-can-be-rearranged-to-contain-a-string-ii": [], +"count-substrings-that-differ-by-one-character": [], +"count-substrings-that-satisfy-k-constraint-i": [], +"count-substrings-that-satisfy-k-constraint-ii": [], +"count-substrings-with-k-frequency-characters-i": [], +"count-substrings-with-k-frequency-characters-ii": [], +"count-substrings-with-only-one-distinct-letter": [], +"count-substrings-without-repeating-character": [], +"count-subtrees-with-max-distance-between-cities": [], +"count-symmetric-integers": [], +"count-tested-devices-after-test-operations": [], +"count-the-digits-that-divide-a-number": [], +"count-the-hidden-sequences": [], +"count-the-number-of-beautiful-subarrays": [], +"count-the-number-of-complete-components": [], +"count-the-number-of-consistent-strings": [], +"count-the-number-of-fair-pairs": [ +"1c33cb8a8b5d758b", +"99bdee9e4480fc4b", +"a23fe6ed2fa84b9c", +"af987bf4f951179c", +"deef2a8a0fd11b38", +"ebb4bf3b89df6f23" +], +"count-the-number-of-good-nodes": [], +"count-the-number-of-good-subarrays": [], +"count-the-number-of-houses-at-a-certain-distance-i": [], +"count-the-number-of-houses-at-a-certain-distance-ii": [], +"count-the-number-of-ideal-arrays": [], +"count-the-number-of-incremovable-subarrays-i": [], +"count-the-number-of-incremovable-subarrays-ii": [], +"count-the-number-of-inversions": [], +"count-the-number-of-k-big-indices": [], +"count-the-number-of-k-free-subsets": [], +"count-the-number-of-powerful-integers": [], +"count-the-number-of-special-characters-i": [], +"count-the-number-of-special-characters-ii": [], +"count-the-number-of-substrings-with-dominant-ones": [], +"count-the-number-of-vowel-strings-in-range": [ +"a188714e2b54f6d4" +], +"count-the-number-of-winning-sequences": [], +"count-the-repetitions": [], +"count-total-number-of-colored-cells": [], +"count-triplets-that-can-form-two-arrays-of-equal-xor": [], +"count-triplets-with-even-xor-set-bits-i": [], +"count-triplets-with-even-xor-set-bits-ii": [], +"count-unguarded-cells-in-the-grid": [], +"count-unhappy-friends": [ +"05bcc51360af0eb3", +"060b48a65f192fe8", +"2c5f2d0d0cd37245", +"36c5c0a41c64f909", +"3e6d516ed0010c21", +"40b02bba5d48bdd0", +"4a4be26998ba6a02", +"508e416ac150ee8e", +"7763a5ac3f0d18df", +"8bc7abe04b84417c", +"936bb7ea8befa161", +"9c5de913b7caddd9", +"bd34f1ec3c73e278", +"be4e87821c7577de", +"c7c805f47bdd03eb", +"da73eac848b7a68d", +"dbadba8d7e3f51f8", +"e7119f91a65459f4", +"f6cedfefcc23f222" +], +"count-unique-characters-of-all-substrings-of-a-given-string": [ +"8f19a5c07e128336", +"dffc0afec578ab93" +], +"count-univalue-subtrees": [], +"count-unreachable-pairs-of-nodes-in-an-undirected-graph": [], +"count-valid-paths-in-a-tree": [], +"count-visited-nodes-in-a-directed-graph": [], +"count-vowel-strings-in-ranges": [], +"count-vowel-substrings-of-a-string": [], +"count-vowels-permutation": [], +"count-ways-to-build-good-strings": [], +"count-ways-to-build-rooms-in-an-ant-colony": [], +"count-ways-to-distribute-candies": [], +"count-words-obtained-after-adding-a-letter": [ +"0d4426bb54520e95", +"2eb323868ecba9ff", +"6c6b4d4063d83da1", +"d048f0744ad79d41", +"e591ec40e64a7d30" +], +"count-zero-request-servers": [], +"counting-bits": [], +"counting-elements": [ +"1fd87c6173b65ca9", +"29d311b10933772f", +"331359d6a2e2ece3", +"57ba542c2a39d6df", +"5a13e632d046115c", +"80da361819220d92", +"db42391058c8dcf9" +], +"counting-words-with-a-given-prefix": [], +"couples-holding-hands": [], +"course-schedule": [], +"course-schedule-ii": [], +"course-schedule-iii": [], +"course-schedule-iv": [ +"4022893714c14c98", +"82c36d039095425c", +"baccacc18896c44b" +], +"cousins-in-binary-tree": [], +"cousins-in-binary-tree-ii": [], +"cracking-the-safe": [], +"crawler-log-folder": [], +"create-binary-tree-from-descriptions": [], +"create-components-with-same-value": [ +"19405bcf9c490d54" +], +"create-maximum-number": [], +"create-sorted-array-through-instructions": [], +"create-target-array-in-the-given-order": [ +"07fcee8ccdc13d17", +"176ac8cbdd752aa5", +"1bc6716446835ac9", +"1d2ee0de4414b421", +"248054ae017d5fa3", +"2fa9b527ebe75dca", +"3481a0a0cc5dd51c", +"363f314b30a2a50b", +"373a9a8090cee169", +"3d434801e9d6df29", +"3ed82d324e5af85c", +"4066cec016007ebd", +"41994bec0d1727a0", +"444b07abf75ef3b6", +"59e73150dcf4b8cb", +"5e7f56c2c50ed8f1", +"600205495dc86a64", +"61962176bb22ecbd", +"6443d711a4aa1bf4", +"654739935610682d", +"6f10fcc908229a3b", +"7343bc7e9e74e988", +"78452e8159a54a09", +"7da1287ed74ddba3", +"7da1287ed74ddba3", +"848e1dcdbf0a3956", +"8748f2b3219991a7", +"882b6dc56941a26f", +"8a13354c821d1d5f", +"94d06b871a8128f6", +"a0ba19a19661b981", +"a3995682dd58769f", +"acb5816c3754ae4b", +"b0af60879ddcc27d", +"b20732de8b336f3b", +"bac9947de757b3d1", +"bdb36bc10284dd0f", +"c91b41c07060e152", +"cbd329c86e577765", +"ce4a7594e7f2d949", +"d6e34a49ba739a81", +"daeae49b57281423", +"e827b50f8a1388a6", +"f424930bcce6aa5f", +"f51e807dc667897a", +"f85390dfb64d6081" +], +"critical-connections-in-a-network": [], +"custom-sort-string": [], +"cut-off-trees-for-golf-event": [], +"cutting-ribbons": [], +"cycle-length-queries-in-a-tree": [], +"cyclically-rotating-a-grid": [], +"daily-temperatures": [], +"day-of-the-week": [], +"day-of-the-year": [], +"decode-string": [], +"decode-the-message": [], +"decode-the-slanted-ciphertext": [], +"decode-ways": [], +"decode-ways-ii": [], +"decode-xored-array": [], +"decode-xored-permutation": [], +"decoded-string-at-index": [], +"decompress-run-length-encoded-list": [], +"decrease-elements-to-make-array-zigzag": [], +"decremental-string-concatenation": [], +"decrypt-string-from-alphabet-to-integer-mapping": [ +"b682c51a0e4b4ce7" +], +"deepest-leaves-sum": [], +"defanging-an-ip-address": [], +"defuse-the-bomb": [], +"degree-of-an-array": [], +"delete-and-earn": [ +"4dc037733e02ef85" +], +"delete-characters-to-make-fancy-string": [], +"delete-columns-to-make-sorted": [], +"delete-columns-to-make-sorted-ii": [], +"delete-columns-to-make-sorted-iii": [], +"delete-duplicate-folders-in-system": [], +"delete-greatest-value-in-each-row": [], +"delete-leaves-with-a-given-value": [], +"delete-n-nodes-after-m-nodes-of-a-linked-list": [], +"delete-node-in-a-bst": [], +"delete-nodes-from-linked-list-present-in-array": [], +"delete-operation-for-two-strings": [], +"delete-the-middle-node-of-a-linked-list": [], +"delete-tree-nodes": [], +"delivering-boxes-from-storage-to-ports": [ +"52b63f4b590d596f" +], +"depth-of-bst-given-insertion-order": [ +"39cfafb32d36a879", +"477ce47d10d5e2b8", +"e0b10429797b9386" +], +"describe-the-painting": [], +"destination-city": [], +"destroy-sequential-targets": [], +"destroying-asteroids": [], +"detect-capital": [], +"detect-cycles-in-2d-grid": [], +"detect-pattern-of-length-m-repeated-k-or-more-times": [], +"determine-color-of-a-chessboard-square": [], +"determine-if-a-cell-is-reachable-at-a-given-time": [], +"determine-if-string-halves-are-alike": [], +"determine-if-two-events-have-conflict": [], +"determine-if-two-strings-are-close": [], +"determine-the-minimum-sum-of-a-k-avoiding-array": [], +"determine-the-winner-of-a-bowling-game": [], +"determine-whether-matrix-can-be-obtained-by-rotation": [], +"detonate-the-maximum-bombs": [], +"di-string-match": [], +"diagonal-traverse": [], +"diagonal-traverse-ii": [], +"diameter-of-binary-tree": [], +"dice-roll-simulation": [], +"diet-plan-performance": [], +"difference-between-element-sum-and-digit-sum-of-an-array": [], +"difference-between-maximum-and-minimum-price-sum": [], +"difference-between-ones-and-zeros-in-row-and-column": [], +"difference-of-number-of-distinct-values-on-diagonals": [], +"different-ways-to-add-parentheses": [ +"146090e9102e68f1", +"2ddc33dd1d3a17d9", +"325186779b1cfc22", +"9303b47f93d7935c", +"e790da9b57ad75e2" +], +"digit-count-in-range": [], +"digit-operations-to-make-two-integers-equal": [], +"disconnect-path-in-a-binary-matrix-by-at-most-one-flip": [], +"display-table-of-food-orders-in-a-restaurant": [], +"distance-between-bus-stops": [], +"distance-to-a-cycle-in-undirected-graph": [], +"distant-barcodes": [ +"01a37134650bb3f1", +"41a47ed5e1434803", +"f06cb6ba0e154d87" +], +"distinct-echo-substrings": [], +"distinct-numbers-in-each-subarray": [], +"distinct-prime-factors-of-product-of-array": [], +"distinct-subsequences": [], +"distinct-subsequences-ii": [], +"distribute-candies": [], +"distribute-candies-among-children-i": [], +"distribute-candies-among-children-ii": [], +"distribute-candies-among-children-iii": [], +"distribute-candies-to-people": [], +"distribute-coins-in-binary-tree": [], +"distribute-elements-into-two-arrays-i": [], +"distribute-elements-into-two-arrays-ii": [], +"distribute-money-to-maximum-children": [], +"distribute-repeating-integers": [], +"divide-a-string-into-groups-of-size-k": [], +"divide-an-array-into-subarrays-with-minimum-cost-i": [ +"6a491d0e647be997" +], +"divide-an-array-into-subarrays-with-minimum-cost-ii": [ +"1ae2689b23d46eb7", +"1ae2689b23d46eb7", +"4cb0b4f1c49aeef1", +"75c19ab736399123", +"aa82bfbb9e53101f", +"cda6c8db71b11ec1", +"d574ddc475741200", +"f4b8e8bb0f39d55c" +], +"divide-array-in-sets-of-k-consecutive-numbers": [], +"divide-array-into-arrays-with-max-difference": [], +"divide-array-into-equal-pairs": [ +"65ceda71aef9a026", +"c1bc51e44280f0df", +"f3e8679c0519c5ae" +], +"divide-array-into-increasing-sequences": [], +"divide-chocolate": [], +"divide-intervals-into-minimum-number-of-groups": [], +"divide-nodes-into-the-maximum-number-of-groups": [], +"divide-players-into-teams-of-equal-skill": [], +"divide-two-integers": [], +"divisible-and-non-divisible-sums-difference": [], +"divisor-game": [], +"domino-and-tromino-tiling": [], +"dota2-senate": [], +"double-a-number-represented-as-a-linked-list": [], +"dungeon-game": [], +"earliest-possible-day-of-full-bloom": [], +"earliest-second-to-mark-indices-i": [], +"eat-pizzas": [], +"edit-distance": [], +"egg-drop-with-2-eggs-and-n-floors": [], +"element-appearing-more-than-25-in-sorted-array": [], +"elements-in-array-after-removing-and-replacing-elements": [], +"eliminate-maximum-number-of-monsters": [], +"elimination-game": [], +"encode-number": [], +"encode-string-with-shortest-length": [], +"equal-rational-numbers": [], +"equal-row-and-column-pairs": [], +"equal-sum-arrays-with-minimum-number-of-operations": [], +"equal-tree-partition": [], +"equalize-strings-by-adding-or-removing-characters-at-ends": [], +"erect-the-fence": [ +"16aa088d4fbc3d26", +"360c16e38b392049", +"bcc296e1c34998f3" +], +"erect-the-fence-ii": [], +"escape-a-large-maze": [], +"escape-the-ghosts": [], +"escape-the-spreading-fire": [], +"evaluate-boolean-binary-tree": [ +"368233c969cc8832", +"6a09f355f0b3ab37", +"7a78bbb047afea7a", +"fd8790e659250288" +], +"evaluate-division": [], +"evaluate-reverse-polish-notation": [ +"075a3279eacc67ad", +"203266c1e3a634f2", +"254b7fc601db51b6", +"3069334f46ee0ecf", +"42af9663f1595e8c", +"70bc09906892c164", +"70d372a098bc6a4c", +"73bcc189cacc0df7", +"7e7a28733cf11ec0", +"a97baf2b8303a0e7", +"b77afe32935ac36d", +"c44f06b7d05c4106", +"c4af643b03956a7b", +"cc767ee540823cbf", +"ed067dab6a5af0d1" +], +"evaluate-the-bracket-pairs-of-a-string": [], +"even-odd-tree": [], +"excel-sheet-column-number": [], +"excel-sheet-column-title": [], +"exclusive-time-of-functions": [], +"execution-of-all-suffix-instructions-staying-in-a-grid": [], +"existence-of-a-substring-in-a-string-and-its-reverse": [ +"5b65f18279c34092" +], +"expression-add-operators": [], +"expressive-words": [], +"extra-characters-in-a-string": [], +"factor-combinations": [], +"factorial-trailing-zeroes": [], +"fair-candy-swap": [ +"01f31dee639547d1", +"578193fb6fe445c7", +"e4bebe1a09527628" +], +"fair-distribution-of-cookies": [], +"falling-squares": [], +"faulty-keyboard": [], +"faulty-sensor": [], +"fibonacci-number": [], +"filling-bookcase-shelves": [], +"filter-restaurants-by-vegan-friendly-price-and-distance": [], +"final-array-state-after-k-multiplication-operations-i": [], +"final-prices-with-a-special-discount-in-a-shop": [], +"final-value-of-variable-after-performing-operations": [], +"find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree": [], +"find-a-good-subset-of-the-matrix": [], +"find-a-peak-element-ii": [], +"find-a-safe-walk-through-a-grid": [], +"find-a-value-of-a-mysterious-function-closest-to-target": [], +"find-all-anagrams-in-a-string": [], +"find-all-duplicates-in-an-array": [], +"find-all-good-indices": [], +"find-all-good-strings": [], +"find-all-groups-of-farmland": [], +"find-all-k-distant-indices-in-an-array": [], +"find-all-lonely-numbers-in-the-array": [], +"find-all-numbers-disappeared-in-an-array": [ +"002712ac1b41c4c3", +"0ba576ba73776ae7", +"1470b4576a9f534c", +"4454ce968a332cda", +"4ae706c79c077d54", +"778028853f56f742", +"7ad4a67f87c9b669", +"854d37a650cf6b78", +"b7060f9ceb29d6ae", +"db4ac0d0ab128c60", +"dbf688afa7b59a81" +], +"find-all-people-with-secret": [], +"find-all-possible-recipes-from-given-supplies": [], +"find-all-possible-stable-binary-arrays-i": [], +"find-all-possible-stable-binary-arrays-ii": [], +"find-all-the-lonely-nodes": [], +"find-anagram-mappings": [], +"find-and-replace-in-string": [ +"64fb4ff71606a0b5", +"d44dd8ea106caa2b", +"f40f3687fa466bc2" +], +"find-and-replace-pattern": [ +"ff80b6f430f7d843" +], +"find-array-given-subset-sums": [ +"027c967c7f54e079", +"02a0644418a5c4b7", +"02a0644418a5c4b7", +"03346a91c442b522", +"07b6dd8c84d2f121", +"07dafc97c02bf52c", +"08bb91d3cb4bfbce", +"100e7dc92f2f79a9", +"102e51692960c475", +"102fe818792eeee2", +"1e3247a343f312bd", +"25556551452775e1", +"2c12796f1b8c1d57", +"2c12796f1b8c1d57", +"407fd70fbb1e104a", +"409c54901a18effa", +"47de0435f6219635", +"514e73d67dc638c2", +"586873e1a7f04747", +"5bf39640dd72cf81", +"5d55648b6ad293ba", +"61c53e1fdfb03faf", +"62dd56b7d4b1fe56", +"7344058ec14fb235", +"7410b18d944f499e", +"77b223e76799cbcb", +"7c3ceae66dff149b", +"7d3cab675ec2b280", +"809a241892d30236", +"8aee92736e39caa8", +"94b289bd22df9018", +"99dafe18c552c295", +"9a608a87ec84a766", +"9b02b0240991845c", +"9ed2e89e5e9e628a", +"a514d6261c0fac82", +"a72f521a393c2e9f", +"abb6f84c47994bef", +"ae0101341a00a43b", +"b196c89fcddaa1e5", +"b7d8f55056f38c5d", +"c093dd6d380b7d76", +"c5f42a77a2969a79", +"cce73aee104f13e4", +"ccea189326fae915", +"d78529b1e3e67635", +"d8d8e4b7b221281c", +"d9b6c079acfeab6d", +"d9b6c079acfeab6d", +"de8090b8a611f367", +"df90f0fe7e38e5a1", +"df90f0fe7e38e5a1", +"e515efb7c56d84be", +"e784dec7d14c172a", +"e91402b0387eb0e7", +"eee7a1c236625c60", +"f14ca26550773c8e", +"f6f4a684606914ec", +"f6f4a684606914ec", +"ff7e370afa7e4db2" +], +"find-beautiful-indices-in-the-given-array-i": [], +"find-beautiful-indices-in-the-given-array-ii": [], +"find-bottom-left-tree-value": [], +"find-building-where-alice-and-bob-can-meet": [], +"find-center-of-star-graph": [], +"find-champion-i": [], +"find-champion-ii": [], +"find-closest-node-to-given-two-nodes": [], +"find-closest-number-to-zero": [], +"find-common-characters": [], +"find-common-elements-between-two-arrays": [ +"3a34ba086fdf7ae0" +], +"find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree": [], +"find-distance-in-a-binary-tree": [], +"find-duplicate-file-in-system": [], +"find-edges-in-shortest-paths": [], +"find-eventual-safe-states": [ +"012438fd2eb3c487", +"052e2f26118b5345", +"05be78f2d716afec", +"2004397a654857e7", +"2c0e3704486bf77c", +"57c660c87747bdf9", +"644ec9e5f8f26162", +"6be973e6aef782c5", +"80266d3d20032ea7", +"8d20c5aa6f3f117e", +"bd87cb29ae6693e7", +"dd76bfc30e45ee7d", +"f52ec084bd443d56" +], +"find-first-and-last-position-of-element-in-sorted-array": [], +"find-first-palindromic-string-in-the-array": [], +"find-good-days-to-rob-the-bank": [], +"find-greatest-common-divisor-of-array": [ +"43e91125379042a5", +"5839cf06259a1b76", +"7652b0a3ed3f370e", +"801601afc0bfb591", +"9b97cc6fae9786dc", +"b42990a64140e5be", +"f50fd765debb6f0c", +"fc8771a63b89d419" +], +"find-if-array-can-be-sorted": [], +"find-if-digit-game-can-be-won": [], +"find-if-path-exists-in-graph": [], +"find-indices-of-stable-mountains": [], +"find-indices-with-index-and-value-difference-i": [], +"find-indices-with-index-and-value-difference-ii": [], +"find-k-closest-elements": [], +"find-k-length-substrings-with-no-repeated-characters": [], +"find-k-pairs-with-smallest-sums": [], +"find-k-th-smallest-pair-distance": [], +"find-kth-bit-in-nth-binary-string": [], +"find-kth-largest-xor-coordinate-value": [ +"ddeeee58351464f9" +], +"find-largest-value-in-each-tree-row": [], +"find-latest-group-of-size-m": [], +"find-leaves-of-binary-tree": [], +"find-longest-awesome-substring": [], +"find-longest-self-contained-substring": [], +"find-longest-special-substring-that-occurs-thrice-i": [], +"find-longest-special-substring-that-occurs-thrice-ii": [], +"find-lucky-integer-in-an-array": [], +"find-maximal-uncovered-ranges": [], +"find-maximum-non-decreasing-array-length": [], +"find-maximum-number-of-string-pairs": [ +"1641f971a1627648", +"1c16bd3d2e857a65", +"67062760fea4fc5d", +"67e88138ee6cd704", +"6b6be14237016efa", +"74db8c555d37658d", +"a0be34c6461e666d", +"aa503196eb5f546c", +"d8917ac1af7cd0a4", +"e3fa7f5c43bbf37f", +"eb768f9864040c13" +], +"find-maximum-removals-from-source-string": [ +"37708036250b547d", +"383d72e251bd08f1", +"4806674718ce58af", +"50d11c1740c66eef", +"7cf13d061e256533", +"a5a629313b088a12", +"af7710643df2f3ef", +"cb370979a55dcfab", +"e4b401d8479e736d" +], +"find-minimum-cost-to-remove-array-elements": [], +"find-minimum-diameter-after-merging-two-trees": [ +"54b61807dc547269", +"89b1f90e479be9d5" +], +"find-minimum-in-rotated-sorted-array": [ +"006890f8a729a1df", +"1295d282405dabc1", +"2dfee1b753394fbc", +"2eb06c62e2087aad", +"3b8489cbf819f3c7", +"b09a49300b130991", +"f6519bcb3846da3b" +], +"find-minimum-in-rotated-sorted-array-ii": [], +"find-minimum-operations-to-make-all-elements-divisible-by-three": [], +"find-minimum-time-to-finish-all-jobs": [], +"find-minimum-time-to-finish-all-jobs-ii": [], +"find-minimum-time-to-reach-last-room-i": [], +"find-minimum-time-to-reach-last-room-ii": [], +"find-mirror-score-of-a-string": [], +"find-missing-and-repeated-values": [ +"07123d07478d0e82", +"16f17648fd96fe86", +"2db29bb6ba5c5387", +"32764d3f296d037f", +"469f4bb6f87b6118", +"758a224f3fccac34", +"8b5d7de5c6c887de", +"8e6279a0a0cd3cc7", +"ab3c78679f765e08", +"b2fa5effbaffa052", +"b6b096aec8528682", +"d4853f027c2b94cc" +], +"find-missing-observations": [], +"find-mode-in-binary-search-tree": [], +"find-n-unique-integers-sum-up-to-zero": [], +"find-nearest-point-that-has-the-same-x-or-y-coordinate": [], +"find-number-of-coins-to-place-in-tree-nodes": [], +"find-number-of-ways-to-reach-the-k-th-stair": [], +"find-numbers-with-even-number-of-digits": [], +"find-occurrences-of-an-element-in-an-array": [ +"86c14c3c59654319" +], +"find-original-array-from-doubled-array": [], +"find-palindrome-with-fixed-length": [], +"find-peak-element": [], +"find-permutation": [], +"find-pivot-index": [], +"find-players-with-zero-or-one-losses": [], +"find-polygon-with-the-largest-perimeter": [], +"find-resultant-array-after-removing-anagrams": [ +"49177f50d2e1947f" +], +"find-right-interval": [], +"find-score-of-an-array-after-marking-all-elements": [], +"find-servers-that-handled-most-number-of-requests": [ +"2b515f9129a0161d", +"458d58831b81397e", +"83c32117e4f3b29b", +"a92383f5e4b3d691" +], +"find-shortest-path-with-k-hops": [], +"find-smallest-common-element-in-all-rows": [], +"find-smallest-letter-greater-than-target": [ +"77d1a3ccdf4fa23a" +], +"find-sorted-submatrices-with-maximum-element-at-most-k": [], +"find-special-substring-of-length-k": [], +"find-subarray-with-bitwise-or-closest-to-k": [], +"find-subarrays-with-equal-sum": [], +"find-subsequence-of-length-k-with-the-largest-sum": [], +"find-substring-with-given-hash-value": [], +"find-subtree-sizes-after-changes": [], +"find-target-indices-after-sorting-array": [], +"find-the-array-concatenation-value": [ +"012bd310bdda02b2", +"265ff0e4823bc554", +"2931eb7016c161a4", +"315be98d3aa98857", +"4085116661863c48", +"52663f22d15b1910", +"582a9f455fbe0c10", +"65f016dcb3068420", +"845551b1e9f15ef7", +"8833affc5128c2f4", +"885221f9873ca9d4", +"8abba44719cc0bd5", +"8cc940fb17561d4f", +"9b64999be9e55a92", +"b776d19b0e0f61d4", +"bc272f725b286ac5", +"c51f6fbba7375a41", +"ce9dae956d68e1a7", +"d0ef24eb4195a01f", +"d0ef24eb4195a01f", +"d9531eeab4e6acb6", +"e9d37373d91a8abb", +"ee24a916a3c4487a", +"f8a0cfb0d65c3772", +"ff52ac4d65772215" +], +"find-the-child-who-has-the-ball-after-k-seconds": [], +"find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance": [], +"find-the-closest-marked-node": [], +"find-the-closest-palindrome": [ +"02cf6d985b0ca61a", +"6f9ebfbf55ca3e30" +], +"find-the-count-of-good-integers": [], +"find-the-count-of-monotonic-pairs-i": [], +"find-the-count-of-monotonic-pairs-ii": [], +"find-the-count-of-numbers-which-are-not-special": [], +"find-the-derangement-of-an-array": [], +"find-the-difference": [ +"b8852970cb3fcaa9" +], +"find-the-difference-of-two-arrays": [], +"find-the-distance-value-between-two-arrays": [], +"find-the-distinct-difference-array": [], +"find-the-divisibility-array-of-a-string": [], +"find-the-duplicate-number": [ +"227557900527f96d", +"43a93011be205c92", +"47d5cada6ef27e70", +"6c9a22decc101364", +"9804e5481e1da79e", +"aeea687f57d723d4", +"ba7a0360b04c15e3", +"c2ae2be553128f00", +"c8800cc260c99401", +"e3979e549e889e15" +], +"find-the-encrypted-string": [], +"find-the-first-player-to-win-k-games-in-a-row": [], +"find-the-grid-of-region-average": [], +"find-the-highest-altitude": [], +"find-the-index-of-permutation": [], +"find-the-index-of-the-first-occurrence-in-a-string": [], +"find-the-integer-added-to-array-i": [], +"find-the-integer-added-to-array-ii": [], +"find-the-k-beauty-of-a-number": [], +"find-the-k-or-of-an-array": [], +"find-the-k-sum-of-an-array": [], +"find-the-k-th-character-in-string-game-i": [], +"find-the-k-th-character-in-string-game-ii": [], +"find-the-k-th-lucky-number": [ +"8f5cc3d3dc5cbc1a" +], +"find-the-key-of-the-numbers": [], +"find-the-kth-largest-integer-in-the-array": [], +"find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows": [ +"f5aa2713c347302c" +], +"find-the-largest-almost-missing-integer": [], +"find-the-largest-area-of-square-inside-two-rectangles": [], +"find-the-largest-palindrome-divisible-by-k": [], +"find-the-last-marked-nodes-in-tree": [], +"find-the-length-of-the-longest-common-prefix": [], +"find-the-level-of-tree-with-minimum-sum": [], +"find-the-lexicographically-largest-string-from-the-box-i": [ +"fad483d733425603" +], +"find-the-lexicographically-largest-string-from-the-box-ii": [ +"0f430e1d3a43b28b", +"79844c7758109e15" +], +"find-the-lexicographically-smallest-valid-sequence": [], +"find-the-longest-balanced-substring-of-a-binary-string": [], +"find-the-longest-equal-subarray": [], +"find-the-longest-semi-repetitive-substring": [], +"find-the-longest-substring-containing-vowels-in-even-counts": [], +"find-the-longest-valid-obstacle-course-at-each-position": [], +"find-the-losers-of-the-circular-game": [], +"find-the-maximum-achievable-number": [], +"find-the-maximum-divisibility-score": [], +"find-the-maximum-factor-score-of-array": [], +"find-the-maximum-length-of-a-good-subsequence-i": [], +"find-the-maximum-length-of-a-good-subsequence-ii": [], +"find-the-maximum-length-of-valid-subsequence-i": [], +"find-the-maximum-length-of-valid-subsequence-ii": [], +"find-the-maximum-number-of-elements-in-subset": [], +"find-the-maximum-number-of-fruits-collected": [ +"e2e4133c0b895d45" +], +"find-the-maximum-number-of-marked-indices": [], +"find-the-maximum-sequence-value-of-array": [], +"find-the-maximum-sum-of-node-values": [], +"find-the-median-of-the-uniqueness-array": [], +"find-the-middle-index-in-array": [], +"find-the-minimum-amount-of-time-to-brew-potions": [], +"find-the-minimum-and-maximum-number-of-nodes-between-critical-points": [], +"find-the-minimum-area-to-cover-all-ones-i": [], +"find-the-minimum-area-to-cover-all-ones-ii": [], +"find-the-minimum-cost-array-permutation": [], +"find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k": [ +"2748597a4ea36240", +"45f9490be8628f0f" +], +"find-the-minimum-possible-sum-of-a-beautiful-array": [], +"find-the-most-competitive-subsequence": [], +"find-the-n-th-value-after-k-seconds": [], +"find-the-number-of-copy-arrays": [], +"find-the-number-of-distinct-colors-among-the-balls": [], +"find-the-number-of-good-pairs-i": [], +"find-the-number-of-good-pairs-ii": [], +"find-the-number-of-k-even-arrays": [], +"find-the-number-of-possible-ways-for-an-event": [], +"find-the-number-of-subarrays-where-boundary-elements-are-maximum": [], +"find-the-number-of-subsequences-with-equal-gcd": [], +"find-the-number-of-ways-to-place-people-i": [], +"find-the-number-of-ways-to-place-people-ii": [], +"find-the-number-of-winning-players": [], +"find-the-occurrence-of-first-almost-equal-substring": [], +"find-the-original-array-of-prefix-xor": [], +"find-the-original-typed-string-i": [], +"find-the-original-typed-string-ii": [ +"f866dcb9391ecbca" +], +"find-the-peaks": [], +"find-the-pivot-integer": [], +"find-the-power-of-k-size-subarrays-i": [], +"find-the-power-of-k-size-subarrays-ii": [], +"find-the-prefix-common-array-of-two-arrays": [ +"79c0a9c2bc308379", +"8e93fb35e57004d8", +"99134479a0dcc01e", +"a524bfc8122e6fbf" +], +"find-the-punishment-number-of-an-integer": [], +"find-the-safest-path-in-a-grid": [], +"find-the-score-of-all-prefixes-of-an-array": [], +"find-the-sequence-of-strings-appeared-on-the-screen": [], +"find-the-shortest-superstring": [], +"find-the-smallest-divisor-given-a-threshold": [ +"16921a751450cd46", +"943553ef22d8154f", +"f5cbe30a31d53814" +], +"find-the-string-with-lcp": [], +"find-the-student-that-will-replace-the-chalk": [], +"find-the-substring-with-maximum-cost": [ +"0aca144b9ee62637", +"83ef302aff4024bd", +"cacb07bd54ede416", +"ffcb3bed4a746b63" +], +"find-the-sum-of-encrypted-integers": [], +"find-the-sum-of-subsequence-powers": [], +"find-the-sum-of-the-power-of-all-subsequences": [], +"find-the-town-judge": [], +"find-the-value-of-the-partition": [], +"find-the-width-of-columns-of-a-grid": [ +"c9b0df096a9b5b89" +], +"find-the-winner-of-an-array-game": [], +"find-the-winner-of-the-circular-game": [], +"find-the-winning-player-in-coin-game": [], +"find-the-xor-of-numbers-which-appear-twice": [ +"333f429c5330bd70", +"3f08ccb79d5ec66d", +"3fbe129dc8bd9d85", +"4f36ba8d7a002808", +"4fee493397c7ae50", +"91b9b30a60ea739b", +"987488758e3ce47a", +"b737ae0bbaea4d25", +"b7b03df0cce50964", +"be60bc66e83ba51a", +"bff6cd8051a509fe", +"c0a9da398c9beec5", +"c69b4c39a115ef5a", +"cefdd1b01f03c57e", +"f56d484e20c3962a", +"f6df7d3eca49d97b", +"fbae659318536d75" +], +"find-three-consecutive-integers-that-sum-to-a-given-number": [], +"find-triangular-sum-of-an-array": [], +"find-two-non-overlapping-sub-arrays-each-with-target-sum": [], +"find-unique-binary-string": [], +"find-valid-matrix-given-row-and-column-sums": [], +"find-valid-pair-of-adjacent-digits-in-string": [], +"find-winner-on-a-tic-tac-toe-game": [], +"find-words-containing-character": [], +"find-words-that-can-be-formed-by-characters": [ +"e0fc497a000882b0" +], +"find-x-sum-of-all-k-long-subarrays-i": [], +"find-x-sum-of-all-k-long-subarrays-ii": [], +"find-xor-beauty-of-array": [], +"find-xor-sum-of-all-pairs-bitwise-and": [], +"finding-3-digit-even-numbers": [], +"finding-the-number-of-visible-mountains": [], +"finding-the-users-active-minutes": [], +"first-completely-painted-row-or-column": [], +"first-day-where-you-have-been-in-all-the-rooms": [], +"first-letter-to-appear-twice": [], +"first-missing-positive": [], +"first-unique-character-in-a-string": [], +"fixed-point": [], +"fizz-buzz": [], +"flip-binary-tree-to-match-preorder-traversal": [], +"flip-columns-for-maximum-number-of-equal-rows": [ +"73b346135efb2de0" +], +"flip-equivalent-binary-trees": [], +"flip-game": [], +"flip-game-ii": [], +"flip-string-to-monotone-increasing": [], +"flipping-an-image": [ +"085a06e627d2a76c", +"4cb844a7b25471b5", +"76b87dd285829503", +"7a6dc55d4b00fe6c", +"9690136cdc1e7c52", +"b2330165ee108bf7", +"cd28b60228290923", +"db5dda3afa5f4284" +], +"flood-fill": [], +"flower-planting-with-no-adjacent": [ +"30ff78cc1a75cea6", +"5acb48791e5a865c", +"7ca4f2de8bea0343" +], +"form-array-by-concatenating-subarrays-of-another-array": [], +"form-largest-integer-with-digits-that-add-up-to-target": [], +"form-smallest-number-from-two-digit-arrays": [], +"four-divisors": [], +"fraction-addition-and-subtraction": [ +"099f321252f37d98", +"58e3b981132ca8a2", +"727e3ebc10f5e786", +"85909548392bbf7e", +"9827a53fd89d59ed", +"9e4b13def894dc88", +"b8e6f7434b2df953", +"c779a088c1000702", +"d53ed9dbae2b62f9" +], +"fraction-to-recurring-decimal": [], +"freedom-trail": [], +"frequencies-of-shortest-supersequences": [], +"frequency-of-the-most-frequent-element": [], +"friends-of-appropriate-ages": [], +"frog-jump": [], +"frog-jump-ii": [], +"frog-position-after-t-seconds": [], +"fruit-into-baskets": [], +"fruits-into-baskets-ii": [], +"fruits-into-baskets-iii": [], +"furthest-building-you-can-reach": [], +"furthest-point-from-origin": [], +"game-of-nim": [], +"gas-station": [], +"gcd-sort-of-an-array": [ +"486ecf2896ea303d", +"5f8a743bb52a291b", +"b75d1c597a636043", +"f12a7593281ed80d" +], +"generalized-abbreviation": [], +"generate-a-string-with-characters-that-have-odd-counts": [], +"generate-binary-strings-without-adjacent-zeros": [], +"generate-parentheses": [], +"get-biggest-three-rhombus-sums-in-a-grid": [], +"get-equal-substrings-within-budget": [], +"get-maximum-in-generated-array": [], +"get-the-maximum-score": [], +"get-watched-videos-by-your-friends": [], +"global-and-local-inversions": [], +"goal-parser-interpretation": [], +"goat-latin": [], +"graph-connectivity-with-threshold": [], +"graph-valid-tree": [], +"gray-code": [], +"greatest-common-divisor-of-strings": [ +"699afde473b1259f", +"69e355245bf65e48" +], +"greatest-common-divisor-traversal": [ +"213317db76ab92ab", +"61ba69f52cc0efc5", +"9cfd5989a28ddd60", +"aa7e475324251f0f", +"fb52f1825ba7ae54" +], +"greatest-english-letter-in-upper-and-lower-case": [], +"greatest-sum-divisible-by-three": [], +"grid-game": [], +"grid-illumination": [], +"group-anagrams": [], +"group-shifted-strings": [], +"group-the-people-given-the-group-size-they-belong-to": [ +"0a6de0ec5e0dcceb", +"12d1d8f44e07fe01", +"1c0f46e700962d44", +"1c311d9ca7b7ef3d", +"1c311d9ca7b7ef3d", +"1cc407cf9ad197a6", +"266c67d21fba1313", +"29063405db60fcbc", +"2b88a0397338934b", +"4c821df2d230730a", +"5039a20e1c68e3c8", +"51661a199bc2e8a3", +"5f9bc483c646a1e8", +"5fb2cc9f9d8a0764", +"690654a70e270f39", +"706e6be65c575015", +"70ab811a7b4c105d", +"730436155f16195a", +"75e903e35cee6080", +"77380d55474d86d1", +"7d296c0f768d193b", +"817583fff9ecb68a", +"8544d891dfd1ecfe", +"85c3c913ad8e5bdc", +"88e81a3735fd6ae7", +"8a3caf90b05e771e", +"8da2b8382cd3d0e7", +"94738ba1e4699172", +"999c06575c73cb69", +"a1029caeef574541", +"a888001b21123506", +"b2d5c3d5e32dba8b", +"b75d1c597a636043", +"b7ece596e10cc878", +"bf5e98960c78d95f", +"c4fa47946d30c668", +"cbda081f264ca234", +"d44e1b86cfcd7e8a", +"dc4b118d89385d21", +"de5592bd8137747a", +"e2549609ba143476", +"e4cff351fe276e0f", +"ec85a57f671b5def", +"f43269a36bc2b256", +"f4772da2fb6cba75" +], +"groups-of-special-equivalent-strings": [], +"groups-of-strings": [], +"grumpy-bookstore-owner": [], +"guess-number-higher-or-lower-ii": [], +"h-index": [], +"h-index-ii": [], +"hamming-distance": [], +"hand-of-straights": [], +"handling-sum-queries-after-update": [ +"ddb03739a2be7564" +], +"handshakes-that-dont-cross": [], +"happy-number": [], +"happy-students": [], +"harshad-number": [], +"hash-divided-string": [], +"heaters": [], +"height-checker": [], +"height-of-binary-tree-after-subtree-removal-queries": [], +"height-of-special-binary-tree": [], +"hexspeak": [ +"2bbfce30cbba689b", +"2f36be4cae90a769", +"6d5f60a10118c538", +"8852f26bd7f83f80", +"a33c0586c989796e", +"ba2440ea0c268d39", +"c213a25c482ddebc", +"cf30d4ffec968fb2", +"d27484f79c172c35", +"d8ca1413a4920925", +"db75cf354948e052", +"e48031eeeea3b463", +"f6cebb3019a57e50", +"f92e882187ece3ed", +"fb5f3ce990d20552" +], +"high-access-employees": [], +"high-five": [ +"0994cf06270d085a", +"661d81e08f5cf8e2", +"7b94c3aa799499af", +"a6bffa4aecc67611", +"b7f8eadd120f553a", +"c53f584791be6b8b" +], +"house-robber": [], +"house-robber-ii": [], +"house-robber-iii": [], +"house-robber-iv": [ +"4f8c3afcb396140e", +"60d4962378b50186", +"c71f3678e3c4753a", +"c81aedffd70ef8ef", +"e514252136408e8c" +], +"how-many-apples-can-you-put-into-the-basket": [], +"how-many-numbers-are-smaller-than-the-current-number": [], +"html-entity-parser": [], +"identify-the-largest-outlier-in-an-array": [], +"image-overlap": [], +"image-smoother": [], +"increasing-decreasing-string": [], +"increasing-order-search-tree": [], +"increasing-triplet-subsequence": [], +"increment-submatrices-by-one": [], +"incremental-memory-leak": [], +"index-pairs-of-a-string": [], +"insert-greatest-common-divisors-in-linked-list": [], +"insert-interval": [], +"insert-into-a-binary-search-tree": [ +"065431a368449394", +"0bfb6f6449f2f273", +"2279573b5216a74e", +"25803a939d311837", +"2bc157cbd890023a", +"3cabeea3f54c6a2e", +"3cb7f5384c3b5246", +"50562f742fda37a3", +"5ccf5d5e38ca09c6", +"655e9fbebe943498", +"6dbeb8353ade3548", +"7261208647ac096c", +"7a9ae0311a480d73", +"85ad73e765408aa8", +"87cf7f6bc6c38bc8", +"8a7e8da8f6d99508", +"9be1c3911ed0ff89", +"9c6595bcb466eccf", +"9e5c94be9ed2ccbb", +"a28296486407996a", +"add20ff819e46e42", +"af84ec6c003baeb0", +"b17bf3b7836e9be7", +"b8dfbe5a6eb0f956", +"c8edc816c7d60169", +"cab53ea7e3f194ee", +"d681c5c9c0f87cb3", +"d71a8fc936917b70", +"db540a66c40d861e", +"ee71cc55bd64a50a", +"fef9a1fbc08c37ba" +], +"insertion-sort-list": [], +"insufficient-nodes-in-root-to-leaf-paths": [], +"integer-break": [], +"integer-replacement": [], +"integer-to-english-words": [], +"integer-to-roman": [], +"interleaving-string": [], +"intersection-of-multiple-arrays": [], +"intersection-of-three-sorted-arrays": [ +"600639f42e80b189" +], +"intersection-of-two-arrays": [ +"1b71f13635904a51", +"8e5ab12c65402eaf", +"d8b9714b563d6008", +"ea77576e3c363583" +], +"intersection-of-two-arrays-ii": [ +"19d857ff6b52aa15" +], +"intersection-of-two-linked-lists": [], +"interval-list-intersections": [], +"intervals-between-identical-elements": [], +"invalid-transactions": [], +"invert-binary-tree": [], +"ip-to-cidr": [], +"ipo": [], +"is-array-a-preorder-of-some-binary-tree": [], +"is-graph-bipartite": [], +"is-subsequence": [], +"island-perimeter": [], +"isomorphic-strings": [ +"0414a14c8625e2dd", +"c5af7996092c97f7" +], +"jewels-and-stones": [], +"jump-game": [], +"jump-game-ii": [], +"jump-game-iii": [], +"jump-game-iv": [], +"jump-game-v": [], +"jump-game-vi": [], +"jump-game-vii": [], +"jump-game-viii": [], +"k-closest-points-to-origin": [], +"k-concatenation-maximum-sum": [], +"k-diff-pairs-in-an-array": [], +"k-divisible-elements-subarrays": [], +"k-empty-slots": [], +"k-highest-ranked-items-within-a-price-range": [], +"k-inverse-pairs-array": [], +"k-items-with-the-maximum-sum": [], +"k-radius-subarray-averages": [], +"k-similar-strings": [], +"k-th-largest-perfect-subtree-size-in-binary-tree": [], +"k-th-nearest-obstacle-queries": [], +"k-th-smallest-in-lexicographical-order": [], +"k-th-smallest-prime-fraction": [], +"k-th-symbol-in-grammar": [], +"keep-multiplying-found-values-by-two": [], +"keyboard-row": [ +"81d155665fde4408", +"a332b676aa629eb3", +"cdab853f3a89a5d4" +], +"keys-and-rooms": [], +"kids-with-the-greatest-number-of-candies": [], +"kill-process": [ +"1d5d313d314aea56", +"45307a84943598cb" +], +"knight-dialer": [], +"knight-probability-in-chessboard": [], +"koko-eating-bananas": [ +"1176c6bd91427779", +"141c696b3adc1a31", +"1a8307b64ffa3ef7", +"2741b59be7f49f0f", +"293959a58f9b6623", +"34e5b7a117a19420", +"34e5b7a117a19420", +"4b27f7c3c72dcd0a", +"51df8183d98fcfad", +"5ef8dc67aa5633fa", +"5fc756e4d5e5aabf", +"63c8e8ab745f67ad", +"7537fcb7dfcaf5eb", +"9374a65aae2fea79", +"943553ef22d8154f", +"973d37ea46cb98ae", +"a7cb603c71874713", +"bf8e9200bad3b9bc", +"c6f7c3ddedeed8ec", +"f685864e7d318506", +"f685864e7d318506", +"fcc340a0e8255a02" +], +"kth-distinct-string-in-an-array": [], +"kth-largest-element-in-an-array": [], +"kth-largest-sum-in-a-binary-tree": [], +"kth-missing-positive-number": [], +"kth-smallest-amount-with-single-denomination-combination": [], +"kth-smallest-element-in-a-bst": [], +"kth-smallest-element-in-a-sorted-matrix": [], +"kth-smallest-instructions": [], +"kth-smallest-number-in-multiplication-table": [], +"kth-smallest-product-of-two-sorted-arrays": [ +"071f4a26b5946307", +"1735fa50412768ad", +"1c2578a3c9047dc9", +"289e29d2672640b7", +"38e603d3f9604711", +"392741d157a3cccb", +"41b66c668433dff1", +"56e3965d66da001c", +"5cbe5d00cf8656dc", +"90e135f1e2d25f3a", +"ad532b032934160e", +"d3725ca57bbc0e4f", +"f25cbfe6e16fdacc", +"f434d9858f903c47", +"f98cab5aac4d2ae4" +], +"kth-smallest-subarray-sum": [ +"3b921a9078079634", +"40c86fba89287ea0", +"4586683bd18d4941", +"53ab584e740b42c0", +"5bba9eccf8ea4ec9", +"815d4d5748781f2f", +"850ab9ffefaf9224", +"86467272a8401024", +"97399d60e6f3f8f6", +"b6f4fc067bd5ac26", +"b89d0815124a5ce7", +"b8a34468de9f0d8e", +"c0333c707d99ded6", +"cf76cf5d9352a014", +"e2cfa9122e7931ff", +"ea20f51d5618f04f", +"ec6866edbdf8e200", +"f1a93a538def8326", +"f3e9fa84ad9fc5aa", +"fad5a3aaf72ced88" +], +"largest-1-bordered-square": [], +"largest-3-same-digit-number-in-string": [], +"largest-bst-subtree": [], +"largest-color-value-in-a-directed-graph": [], +"largest-combination-with-bitwise-and-greater-than-zero": [], +"largest-component-size-by-common-factor": [], +"largest-divisible-subset": [ +"8eb881fcf146ed36" +], +"largest-element-in-an-array-after-merge-operations": [], +"largest-local-values-in-a-matrix": [], +"largest-magic-square": [], +"largest-merge-of-two-strings": [], +"largest-multiple-of-three": [], +"largest-number": [], +"largest-number-after-digit-swaps-by-parity": [], +"largest-number-after-mutating-substring": [ +"0f5b50f45c24d818" +], +"largest-number-at-least-twice-of-others": [], +"largest-odd-number-in-string": [], +"largest-palindrome-product": [], +"largest-palindromic-number": [], +"largest-perimeter-triangle": [], +"largest-plus-sign": [], +"largest-positive-integer-that-exists-with-its-negative": [], +"largest-rectangle-in-histogram": [], +"largest-subarray-length-k": [], +"largest-submatrix-with-rearrangements": [], +"largest-substring-between-two-equal-characters": [], +"largest-sum-of-averages": [], +"largest-time-for-given-digits": [], +"largest-triangle-area": [], +"largest-unique-number": [ +"3158d1989be89750", +"5989ac92c885e212", +"eb4744d380ce307b" +], +"largest-values-from-labels": [], +"last-day-where-you-can-still-cross": [ +"7af5f01ef576ae16" +], +"last-moment-before-all-ants-fall-out-of-a-plank": [], +"last-stone-weight": [], +"last-stone-weight-ii": [], +"last-substring-in-lexicographical-order": [], +"last-visited-integers": [], +"latest-time-by-replacing-hidden-digits": [], +"latest-time-you-can-obtain-after-replacing-characters": [ +"0b2d50439b80608c", +"1b48b698d3f086ac", +"325deca46ea2ed04", +"4fe2e8c735e767f4", +"53627407a51a549e", +"56da5f08909dba58", +"5aa78e0eeae14cae", +"67bf3c56e220edf0", +"8d7b4e5d4f4a88b1", +"8ec47d0cf51d7414", +"94ed93a084102b93", +"cf954aba2d4f36e1", +"da2d279586a9dafc", +"ebccb0074a522ad6" +], +"leaf-similar-trees": [], +"least-number-of-unique-integers-after-k-removals": [], +"least-operators-to-express-number": [], +"left-and-right-sum-differences": [], +"lemonade-change": [], +"length-of-last-word": [], +"length-of-longest-fibonacci-subsequence": [], +"length-of-longest-subarray-with-at-most-k-frequency": [], +"length-of-longest-v-shaped-diagonal-segment": [], +"length-of-the-longest-alphabetical-continuous-substring": [], +"length-of-the-longest-increasing-path": [], +"length-of-the-longest-subsequence-that-sums-to-target": [], +"length-of-the-longest-valid-substring": [], +"letter-case-permutation": [], +"letter-combinations-of-a-phone-number": [ +"7368aeeaa22c7343", +"8a78127b265a9491" +], +"letter-tile-possibilities": [], +"lexicographical-numbers": [], +"lexicographically-minimum-string-after-removing-stars": [], +"lexicographically-smallest-beautiful-string": [], +"lexicographically-smallest-equivalent-string": [], +"lexicographically-smallest-generated-string": [], +"lexicographically-smallest-palindrome": [], +"lexicographically-smallest-string-after-a-swap": [], +"lexicographically-smallest-string-after-applying-operations": [ +"0e25afb162964c3c", +"1a16a1426ad5a55f", +"2a1a4645ac5c4b5e", +"4e818e50379c5439", +"66952ea0d87e1172", +"a9e7689512539de8", +"b4b4a00ca6f9e48f" +], +"lexicographically-smallest-string-after-operations-with-constraint": [], +"lexicographically-smallest-string-after-substring-operation": [], +"license-key-formatting": [], +"line-reflection": [], +"linked-list-components": [], +"linked-list-cycle": [], +"linked-list-frequency": [], +"linked-list-in-binary-tree": [], +"lonely-pixel-i": [], +"lonely-pixel-ii": [], +"long-pressed-name": [], +"longer-contiguous-segments-of-ones-than-zeros": [], +"longest-absolute-file-path": [], +"longest-alternating-subarray": [], +"longest-arithmetic-subsequence": [ +"374e1c31a68b5533" +], +"longest-arithmetic-subsequence-of-given-difference": [], +"longest-binary-subsequence-less-than-or-equal-to-k": [], +"longest-chunked-palindrome-decomposition": [], +"longest-common-prefix": [], +"longest-common-prefix-after-at-most-one-removal": [], +"longest-common-prefix-of-k-strings-after-removal": [], +"longest-common-subpath": [], +"longest-common-subsequence": [], +"longest-common-subsequence-between-sorted-arrays": [], +"longest-common-suffix-queries": [ +"3ed905d9c0e1bd15" +], +"longest-consecutive-sequence": [ +"f6c36b0341de69ec" +], +"longest-continuous-increasing-subsequence": [], +"longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit": [], +"longest-cycle-in-a-graph": [], +"longest-duplicate-substring": [], +"longest-even-odd-subarray-with-threshold": [], +"longest-happy-prefix": [], +"longest-happy-string": [], +"longest-harmonious-subsequence": [], +"longest-ideal-subsequence": [], +"longest-increasing-path-in-a-matrix": [], +"longest-increasing-subsequence": [], +"longest-increasing-subsequence-ii": [], +"longest-line-of-consecutive-one-in-matrix": [], +"longest-mountain-in-array": [], +"longest-nice-subarray": [], +"longest-nice-substring": [], +"longest-non-decreasing-subarray-from-two-arrays": [], +"longest-palindrome": [], +"longest-palindrome-after-substring-concatenation-i": [], +"longest-palindrome-after-substring-concatenation-ii": [], +"longest-palindrome-by-concatenating-two-letter-words": [], +"longest-palindromic-subsequence": [], +"longest-palindromic-subsequence-after-at-most-k-operations": [ +"07fcccdd4ed3456a" +], +"longest-palindromic-subsequence-ii": [ +"0b193a4d03c2a813" +], +"longest-palindromic-substring": [], +"longest-path-with-different-adjacent-characters": [], +"longest-repeating-character-replacement": [], +"longest-repeating-substring": [], +"longest-special-path": [], +"longest-special-path-ii": [], +"longest-square-streak-in-an-array": [], +"longest-strictly-increasing-or-strictly-decreasing-subarray": [], +"longest-string-chain": [], +"longest-subarray-of-1s-after-deleting-one-element": [], +"longest-subarray-with-maximum-bitwise-and": [], +"longest-subsequence-repeated-k-times": [], +"longest-subsequence-with-decreasing-adjacent-difference": [], +"longest-subsequence-with-limited-sum": [], +"longest-substring-of-all-vowels-in-order": [], +"longest-substring-of-one-repeating-character": [ +"0b765ee4be50a5a8", +"1a1a3ffc0d9ae535", +"23b76f1a256b609e", +"5f3cbb68ad6615f9", +"69690ed38cdc2eed", +"6afa85fd41048a43", +"d732a525fe3647b5" +], +"longest-substring-with-at-least-k-repeating-characters": [], +"longest-substring-with-at-most-k-distinct-characters": [], +"longest-substring-with-at-most-two-distinct-characters": [], +"longest-substring-without-repeating-characters": [], +"longest-turbulent-subarray": [], +"longest-uncommon-subsequence-i": [], +"longest-uncommon-subsequence-ii": [], +"longest-unequal-adjacent-groups-subsequence-i": [], +"longest-unequal-adjacent-groups-subsequence-ii": [ +"6920e59e959a2d4b" +], +"longest-univalue-path": [], +"longest-valid-parentheses": [], +"longest-well-performing-interval": [], +"longest-word-in-dictionary": [], +"longest-word-in-dictionary-through-deleting": [], +"longest-word-with-all-prefixes": [], +"longest-zigzag-path-in-a-binary-tree": [], +"loud-and-rich": [], +"lowest-common-ancestor-of-deepest-leaves": [], +"lucky-numbers-in-a-matrix": [], +"magic-squares-in-grid": [], +"magical-string": [], +"magnetic-force-between-two-balls": [], +"majority-element": [], +"majority-element-ii": [], +"make-a-square-with-the-same-color": [], +"make-array-elements-equal-to-zero": [], +"make-array-empty": [], +"make-array-non-decreasing-or-non-increasing": [], +"make-array-strictly-increasing": [], +"make-array-zero-by-subtracting-equal-amounts": [ +"4332dbed06f0f975", +"51ed758338c345d5", +"779c254346775400", +"9ba71b4a51af9870" +], +"make-costs-of-paths-equal-in-a-binary-tree": [], +"make-k-subarray-sums-equal": [], +"make-lexicographically-smallest-array-by-swapping-elements": [], +"make-number-of-distinct-characters-equal": [], +"make-string-a-subsequence-using-cyclic-increments": [], +"make-string-anti-palindrome": [], +"make-sum-divisible-by-p": [], +"make-the-prefix-sum-non-negative": [], +"make-the-string-great": [], +"make-the-xor-of-all-segments-equal-to-zero": [], +"make-three-strings-equal": [], +"make-two-arrays-equal-by-reversing-subarrays": [], +"making-a-large-island": [], +"making-file-names-unique": [], +"manhattan-distances-of-all-arrangements-of-pieces": [], +"map-of-highest-peak": [], +"mark-elements-on-array-by-performing-queries": [], +"masking-personal-information": [ +"063148798017c1fa", +"e4243bbd50d4ad16" +], +"match-alphanumerical-pattern-in-matrix-i": [ +"884fb91a84ceb07b" +], +"match-substring-after-replacement": [], +"matchsticks-to-square": [], +"matrix-block-sum": [], +"matrix-cells-in-distance-order": [], +"matrix-diagonal-sum": [], +"matrix-similarity-after-cyclic-shifts": [], +"max-area-of-island": [], +"max-chunks-to-make-sorted": [], +"max-chunks-to-make-sorted-ii": [], +"max-consecutive-ones": [], +"max-consecutive-ones-ii": [], +"max-consecutive-ones-iii": [], +"max-difference-you-can-get-from-changing-an-integer": [], +"max-dot-product-of-two-subsequences": [], +"max-increase-to-keep-city-skyline": [], +"max-number-of-k-sum-pairs": [], +"max-pair-sum-in-an-array": [], +"max-points-on-a-line": [ +"295f761b14260797" +], +"max-sum-of-a-pair-with-equal-sum-of-digits": [], +"max-sum-of-rectangle-no-larger-than-k": [], +"max-value-of-equation": [], +"maximal-network-rank": [ +"71404d5e24149147" +], +"maximal-range-that-each-element-is-maximum-in-it": [], +"maximal-rectangle": [], +"maximal-score-after-applying-k-operations": [], +"maximal-square": [], +"maximize-active-section-with-trade-i": [], +"maximize-active-section-with-trade-ii": [], +"maximize-amount-after-two-days-of-conversions": [], +"maximize-area-of-square-hole-in-grid": [], +"maximize-consecutive-elements-in-an-array-after-modification": [], +"maximize-distance-to-closest-person": [], +"maximize-greatness-of-an-array": [], +"maximize-grid-happiness": [], +"maximize-happiness-of-selected-children": [ +"0fa22149a261db1e" +], +"maximize-number-of-nice-divisors": [], +"maximize-number-of-subsequences-in-a-string": [], +"maximize-palindrome-length-from-subsequences": [], +"maximize-profit-from-task-assignment": [], +"maximize-score-after-pair-deletions": [], +"maximize-score-of-numbers-in-ranges": [], +"maximize-subarray-sum-after-removing-all-occurrences-of-one-element": [], +"maximize-subarrays-after-removing-one-conflicting-pair": [], +"maximize-sum-of-array-after-k-negations": [], +"maximize-sum-of-weights-after-edge-removals": [], +"maximize-the-beauty-of-the-garden": [], +"maximize-the-confusion-of-an-exam": [], +"maximize-the-distance-between-points-on-a-square": [ +"1e5413d6c82458e2", +"471d57d00384adae", +"51a03d68a61af904", +"51fc09a0eb3624c9", +"6685e6f372b6f848", +"7f53f7b29634f3be", +"e52881e9a6a97bda", +"f1abe6a44630e438" +], +"maximize-the-minimum-game-score": [], +"maximize-the-minimum-powered-city": [], +"maximize-the-number-of-partitions-after-operations": [], +"maximize-the-number-of-target-nodes-after-connecting-trees-i": [], +"maximize-the-number-of-target-nodes-after-connecting-trees-ii": [], +"maximize-the-profit-as-the-salesman": [], +"maximize-the-topmost-element-after-k-moves": [], +"maximize-the-total-height-of-unique-towers": [], +"maximize-total-cost-of-alternating-subarrays": [], +"maximize-total-tastiness-of-purchased-fruits": [], +"maximize-value-of-function-in-a-ball-passing-game": [], +"maximize-win-from-two-segments": [], +"maximum-absolute-sum-of-any-subarray": [], +"maximum-alternating-subarray-sum": [], +"maximum-alternating-subsequence-sum": [], +"maximum-amount-of-money-robot-can-earn": [], +"maximum-and-minimum-sums-of-at-most-size-k-subsequences": [], +"maximum-and-sum-of-array": [], +"maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts": [], +"maximum-area-of-longest-diagonal-rectangle": [], +"maximum-area-rectangle-with-point-constraints-i": [], +"maximum-area-rectangle-with-point-constraints-ii": [], +"maximum-array-hopping-score-i": [], +"maximum-array-hopping-score-ii": [], +"maximum-ascending-subarray-sum": [], +"maximum-average-pass-ratio": [], +"maximum-average-subarray-i": [], +"maximum-average-subarray-ii": [ +"ccd8ea32c478f956" +], +"maximum-average-subtree": [], +"maximum-bags-with-full-capacity-of-rocks": [], +"maximum-balanced-subsequence-sum": [], +"maximum-beauty-of-an-array-after-applying-operation": [], +"maximum-binary-string-after-change": [], +"maximum-binary-tree": [], +"maximum-binary-tree-ii": [], +"maximum-building-height": [], +"maximum-candies-allocated-to-k-children": [], +"maximum-candies-you-can-get-from-boxes": [], +"maximum-coin-collection": [], +"maximum-coins-from-k-consecutive-bags": [], +"maximum-coins-heroes-can-collect": [], +"maximum-compatibility-score-sum": [], +"maximum-consecutive-floors-without-special-floors": [], +"maximum-containers-on-a-ship": [], +"maximum-cost-of-trip-with-k-highways": [], +"maximum-count-of-positive-integer-and-negative-integer": [], +"maximum-deletions-on-a-string": [], +"maximum-depth-of-binary-tree": [], +"maximum-difference-between-adjacent-elements-in-a-circular-array": [], +"maximum-difference-between-even-and-odd-frequency-i": [], +"maximum-difference-between-even-and-odd-frequency-ii": [], +"maximum-difference-between-increasing-elements": [], +"maximum-difference-between-node-and-ancestor": [], +"maximum-difference-by-remapping-a-digit": [], +"maximum-difference-score-in-a-grid": [], +"maximum-distance-between-a-pair-of-values": [ +"62a4b8c6c0b073fd", +"8c74dbfb566cefc5" +], +"maximum-distance-in-arrays": [], +"maximum-earnings-from-taxi": [], +"maximum-elegance-of-a-k-length-subsequence": [], +"maximum-element-after-decreasing-and-rearranging": [], +"maximum-element-sum-of-a-complete-subset-of-indices": [], +"maximum-employees-to-be-invited-to-a-meeting": [], +"maximum-enemy-forts-that-can-be-captured": [], +"maximum-energy-boost-from-two-drinks": [], +"maximum-equal-frequency": [], +"maximum-erasure-value": [], +"maximum-frequency-after-subarray-operation": [], +"maximum-frequency-of-an-element-after-performing-operations-i": [], +"maximum-frequency-of-an-element-after-performing-operations-ii": [], +"maximum-fruits-harvested-after-at-most-k-steps": [], +"maximum-gap": [ +"c41b7b4383ed4b60" +], +"maximum-gcd-sum-of-a-subarray": [], +"maximum-genetic-difference-query": [], +"maximum-good-people-based-on-statements": [], +"maximum-good-subarray-sum": [], +"maximum-hamming-distances": [], +"maximum-height-by-stacking-cuboids": [], +"maximum-height-of-a-triangle": [], +"maximum-ice-cream-bars": [], +"maximum-increasing-triplet-value": [], +"maximum-length-of-a-concatenated-string-with-unique-characters": [ +"77058ef2ab5a5e88", +"77058ef2ab5a5e88" +], +"maximum-length-of-pair-chain": [], +"maximum-length-of-repeated-subarray": [], +"maximum-length-of-semi-decreasing-subarrays": [], +"maximum-length-of-subarray-with-positive-product": [], +"maximum-length-substring-with-two-occurrences": [], +"maximum-level-sum-of-a-binary-tree": [], +"maximum-linear-stock-score": [], +"maximum-manhattan-distance-after-k-changes": [], +"maximum-matching-of-players-with-trainers": [], +"maximum-matrix-sum": [], +"maximum-multiplication-score": [], +"maximum-nesting-depth-of-the-parentheses": [], +"maximum-nesting-depth-of-two-valid-parentheses-strings": [ +"23bb72c5a95f6c24", +"69a63d1c4855587d" +], +"maximum-non-negative-product-in-a-matrix": [], +"maximum-number-of-accepted-invitations": [], +"maximum-number-of-achievable-transfer-requests": [], +"maximum-number-of-alloys": [], +"maximum-number-of-balloons": [], +"maximum-number-of-balls-in-a-box": [], +"maximum-number-of-books-you-can-take": [], +"maximum-number-of-coins-you-can-get": [], +"maximum-number-of-consecutive-values-you-can-make": [], +"maximum-number-of-darts-inside-of-a-circular-dartboard": [], +"maximum-number-of-distinct-elements-after-operations": [], +"maximum-number-of-eaten-apples": [], +"maximum-number-of-events-that-can-be-attended": [], +"maximum-number-of-events-that-can-be-attended-ii": [], +"maximum-number-of-fish-in-a-grid": [], +"maximum-number-of-groups-entering-a-competition": [], +"maximum-number-of-groups-getting-fresh-donuts": [], +"maximum-number-of-groups-with-increasing-length": [], +"maximum-number-of-integers-to-choose-from-a-range-i": [], +"maximum-number-of-integers-to-choose-from-a-range-ii": [], +"maximum-number-of-intersections-on-the-chart": [], +"maximum-number-of-jumps-to-reach-the-last-index": [], +"maximum-number-of-k-divisible-components": [], +"maximum-number-of-matching-indices-after-right-shifts": [], +"maximum-number-of-moves-in-a-grid": [], +"maximum-number-of-moves-to-kill-all-pawns": [ +"136cf5a4bd18f65c", +"141078365e4b07c5", +"15505cb78cc6f26b", +"79672d9a30907565", +"ef4947ee57255189" +], +"maximum-number-of-non-overlapping-palindrome-substrings": [], +"maximum-number-of-non-overlapping-subarrays-with-sum-equals-target": [], +"maximum-number-of-non-overlapping-substrings": [], +"maximum-number-of-occurrences-of-a-substring": [ +"4548ca3f4c8e8821", +"826ab869b3d29c5b", +"992c133884f4f5a7" +], +"maximum-number-of-ones": [], +"maximum-number-of-operations-to-move-ones-to-the-end": [], +"maximum-number-of-operations-with-the-same-score-i": [], +"maximum-number-of-operations-with-the-same-score-ii": [], +"maximum-number-of-pairs-in-array": [], +"maximum-number-of-people-that-can-be-caught-in-tag": [], +"maximum-number-of-points-from-grid-queries": [], +"maximum-number-of-points-with-cost": [], +"maximum-number-of-potholes-that-can-be-fixed": [], +"maximum-number-of-removable-characters": [], +"maximum-number-of-removal-queries-that-can-be-processed-i": [], +"maximum-number-of-robots-within-budget": [], +"maximum-number-of-tasks-you-can-assign": [], +"maximum-number-of-upgradable-servers": [], +"maximum-number-of-visible-points": [], +"maximum-number-of-vowels-in-a-substring-of-given-length": [ +"bd2cd93b77a76a33" +], +"maximum-number-of-ways-to-partition-an-array": [], +"maximum-number-of-weeks-for-which-you-can-work": [], +"maximum-number-of-words-found-in-sentences": [], +"maximum-number-of-words-you-can-type": [ +"06e0ad161c3cfbbb", +"0c35e8a4b0287224", +"9a06211453f1ff55", +"be3794554f04ee5e" +], +"maximum-number-that-makes-result-of-bitwise-and-zero": [], +"maximum-number-that-sum-of-the-prices-is-less-than-or-equal-to-k": [], +"maximum-odd-binary-number": [], +"maximum-of-absolute-value-expression": [], +"maximum-of-minimum-values-in-all-subarrays": [], +"maximum-or": [], +"maximum-palindromes-after-operations": [], +"maximum-path-quality-of-a-graph": [], +"maximum-performance-of-a-team": [ +"77d845d45c228ee1" +], +"maximum-points-after-collecting-coins-from-all-nodes": [], +"maximum-points-after-enemy-battles": [], +"maximum-points-in-an-archery-competition": [], +"maximum-points-inside-the-square": [], +"maximum-points-tourist-can-earn": [], +"maximum-points-you-can-obtain-from-cards": [], +"maximum-population-year": [], +"maximum-possible-number-by-binary-concatenation": [], +"maximum-price-to-fill-a-bag": [], +"maximum-prime-difference": [], +"maximum-product-after-k-increments": [], +"maximum-product-difference-between-two-pairs": [], +"maximum-product-of-splitted-binary-tree": [], +"maximum-product-of-the-length-of-two-palindromic-subsequences": [], +"maximum-product-of-the-length-of-two-palindromic-substrings": [ +"63de10428590c503", +"6c224cb06a270dee", +"816f5c0848c6a684" +], +"maximum-product-of-three-numbers": [], +"maximum-product-of-two-elements-in-an-array": [], +"maximum-product-of-word-lengths": [], +"maximum-product-subarray": [], +"maximum-profit-from-trading-stocks": [], +"maximum-profit-in-job-scheduling": [], +"maximum-profit-of-operating-a-centennial-wheel": [], +"maximum-profitable-triplets-with-increasing-prices-i": [], +"maximum-profitable-triplets-with-increasing-prices-ii": [], +"maximum-repeating-substring": [], +"maximum-rows-covered-by-columns": [], +"maximum-running-time-of-n-computers": [], +"maximum-score-after-applying-operations-on-a-tree": [], +"maximum-score-after-splitting-a-string": [], +"maximum-score-from-grid-operations": [], +"maximum-score-from-performing-multiplication-operations": [], +"maximum-score-from-removing-stones": [], +"maximum-score-from-removing-substrings": [], +"maximum-score-of-a-good-subarray": [], +"maximum-score-of-a-node-sequence": [], +"maximum-score-of-spliced-array": [ +"e5c3751d61527d75", +"fa92588716875e43" +], +"maximum-score-words-formed-by-letters": [ +"d465d66b6b9b079e" +], +"maximum-segment-sum-after-removals": [], +"maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold": [], +"maximum-size-of-a-set-after-removals": [], +"maximum-size-subarray-sum-equals-k": [], +"maximum-sized-array": [], +"maximum-spending-after-buying-items": [ +"4546264f42e26aa6", +"70bf73b1bfe6a10c", +"bb01284e90a484fe", +"d63e9c6221802040", +"e575d8f3a9d9551a", +"f3b99899bc59fc5d" +], +"maximum-split-of-positive-even-integers": [], +"maximum-square-area-by-removing-fences-from-a-field": [], +"maximum-star-sum-of-a-graph": [], +"maximum-strength-of-a-group": [], +"maximum-strength-of-k-disjoint-subarrays": [], +"maximum-strictly-increasing-cells-in-a-matrix": [], +"maximum-strong-pair-xor-i": [], +"maximum-strong-pair-xor-ii": [ +"2d004c2d5148b08e" +], +"maximum-students-on-a-single-bench": [], +"maximum-students-taking-exam": [], +"maximum-subarray": [], +"maximum-subarray-min-product": [], +"maximum-subarray-sum-after-one-operation": [], +"maximum-subarray-sum-with-length-divisible-by-k": [], +"maximum-subarray-sum-with-one-deletion": [], +"maximum-subarray-with-equal-products": [ +"38b74840439b22f2", +"38b74840439b22f2", +"3a0c7c1012c3ebd2", +"3a0c7c1012c3ebd2", +"778028853f56f742", +"8391b6aa91f613b8", +"ab3cd0fc07ace07f", +"e453938fa85d39f5" +], +"maximum-subsequence-score": [], +"maximum-subtree-of-the-same-color": [], +"maximum-sum-bst-in-binary-tree": [], +"maximum-sum-circular-subarray": [], +"maximum-sum-obtained-of-any-permutation": [], +"maximum-sum-of-3-non-overlapping-subarrays": [ +"15a33445e592d230", +"c415525cbe529648" +], +"maximum-sum-of-almost-unique-subarray": [], +"maximum-sum-of-an-hourglass": [], +"maximum-sum-of-distinct-subarrays-with-length-k": [], +"maximum-sum-of-subsequence-with-non-adjacent-elements": [], +"maximum-sum-of-two-non-overlapping-subarrays": [], +"maximum-sum-queries": [], +"maximum-sum-score-of-array": [], +"maximum-sum-with-at-most-k-elements": [ +"0b08abc60117e408" +], +"maximum-sum-with-exactly-k-elements": [], +"maximum-swap": [], +"maximum-tastiness-of-candy-basket": [], +"maximum-total-area-occupied-by-pistons": [ +"09cb931504b28ed8", +"365fc45bab3c62c5", +"8156f63c7aa04ba0" +], +"maximum-total-beauty-of-the-gardens": [], +"maximum-total-damage-with-spell-casting": [], +"maximum-total-importance-of-roads": [], +"maximum-total-reward-using-operations-i": [], +"maximum-total-reward-using-operations-ii": [ +"3311b6f592ac05b0", +"50e91bebddd3a52b", +"6f82c8ac335400ab", +"774b8ea2d64d0ac9", +"7de6d1e3c543e90b", +"98f68482fe05396e", +"d9531eeab4e6acb6" +], +"maximum-trailing-zeros-in-a-cornered-path": [], +"maximum-twin-sum-of-a-linked-list": [], +"maximum-unique-subarray-sum-after-deletion": [], +"maximum-units-on-a-truck": [], +"maximum-vacation-days": [], +"maximum-value-after-insertion": [], +"maximum-value-at-a-given-index-in-a-bounded-array": [], +"maximum-value-of-a-string-in-an-array": [], +"maximum-value-of-an-ordered-triplet-i": [], +"maximum-value-of-an-ordered-triplet-ii": [], +"maximum-value-of-k-coins-from-piles": [], +"maximum-value-sum-by-placing-three-rooks-i": [], +"maximum-value-sum-by-placing-three-rooks-ii": [], +"maximum-white-tiles-covered-by-a-carpet": [], +"maximum-width-of-binary-tree": [], +"maximum-width-ramp": [], +"maximum-xor-after-operations": [], +"maximum-xor-for-each-query": [], +"maximum-xor-of-two-non-overlapping-subtrees": [], +"maximum-xor-of-two-numbers-in-an-array": [], +"maximum-xor-product": [], +"maximum-xor-score-subarray-queries": [], +"maximum-xor-with-an-element-from-array": [], +"mean-of-array-after-removing-some-elements": [ +"0843dfb23f6fbf3b", +"088ff7ef884bb937", +"1a1e34682cfeeef7", +"36017b70fd8fe985", +"4d77f84a04c8f9d9", +"4dd21e344e18236c", +"54162a652c0e4ee5", +"5666193ca7d9bcee", +"57ebb8dac4d3c5c0", +"5855654f03534858", +"5961c8182306aded", +"5d5ddd13f37d947c", +"6cf4bf1e2f99f8cd", +"74a1b142131e82bc", +"760be8ec8b736fd9", +"78f63ee132f2ca08", +"98ced9e816f0e37e", +"9db33eb30834a335", +"a203dbe38d7819f9", +"aaec967ebfd04c50", +"b561a6d644ff4bf9", +"b8c8846ea83b0a2b", +"b8c8846ea83b0a2b", +"cb6128ba567a05f8", +"ccf64f9ac273a238", +"d20e925c096026b0", +"d74524ad8e819042", +"e51cf10f6c9b5e45", +"e8912e46c205aadc", +"f19cf016864e67c4", +"f53d1ce4753442d1" +], +"median-of-a-row-wise-sorted-matrix": [], +"median-of-two-sorted-arrays": [], +"meeting-rooms": [], +"meeting-rooms-ii": [], +"meeting-rooms-iii": [ +"3a287a81125c0e8f" +], +"meeting-scheduler": [], +"merge-in-between-linked-lists": [], +"merge-intervals": [], +"merge-k-sorted-lists": [], +"merge-nodes-in-between-zeros": [], +"merge-operations-to-turn-array-into-a-palindrome": [], +"merge-strings-alternately": [], +"merge-triplets-to-form-target-triplet": [], +"merge-two-binary-trees": [], +"merge-two-sorted-lists": [], +"mice-and-cheese": [], +"middle-of-the-linked-list": [], +"min-cost-climbing-stairs": [], +"min-cost-to-connect-all-points": [], +"min-max-game": [], +"minesweeper": [], +"minimize-connected-groups-by-inserting-interval": [], +"minimize-deviation-in-array": [ +"07053329220da202" +], +"minimize-hamming-distance-after-swap-operations": [], +"minimize-length-of-array-using-operations": [], +"minimize-malware-spread": [], +"minimize-malware-spread-ii": [], +"minimize-manhattan-distances": [], +"minimize-max-distance-to-gas-station": [], +"minimize-maximum-of-array": [], +"minimize-maximum-pair-sum-in-array": [], +"minimize-maximum-value-in-a-grid": [], +"minimize-or-of-remaining-elements-using-operations": [], +"minimize-product-sum-of-two-arrays": [], +"minimize-result-by-adding-parentheses-to-expression": [ +"1aaddf273da41e81", +"2f51300f3f9af1b0", +"c2479706c99d79db", +"d4b266f0cf03ff84" +], +"minimize-rounding-error-to-meet-target": [], +"minimize-string-length": [], +"minimize-the-difference-between-target-and-chosen-elements": [ +"22a0fb12d56e5d51" +], +"minimize-the-maximum-difference-of-pairs": [], +"minimize-the-maximum-edge-weight-of-graph": [], +"minimize-the-maximum-of-two-arrays": [], +"minimize-the-total-price-of-the-trips": [], +"minimize-xor": [ +"1e90b186264f0e8c", +"266527e63230b423", +"42b244f9e0bbdcec" +], +"minimized-maximum-of-products-distributed-to-any-store": [ +"14b95a9aafe8793c", +"14c2167ce39a7a4f", +"88218bba2a6c9e49" +], +"minimizing-array-after-replacing-pairs-with-their-product": [], +"minimum-absolute-difference": [], +"minimum-absolute-difference-between-elements-with-constraint": [], +"minimum-absolute-difference-in-bst": [], +"minimum-absolute-difference-queries": [], +"minimum-absolute-sum-difference": [], +"minimum-add-to-make-parentheses-valid": [], +"minimum-addition-to-make-integer-beautiful": [], +"minimum-additions-to-make-valid-string": [], +"minimum-adjacent-swaps-for-k-consecutive-ones": [], +"minimum-adjacent-swaps-to-make-a-valid-array": [], +"minimum-adjacent-swaps-to-reach-the-kth-smallest-number": [], +"minimum-amount-of-damage-dealt-to-bob": [], +"minimum-amount-of-time-to-collect-garbage": [], +"minimum-amount-of-time-to-fill-cups": [], +"minimum-area-rectangle": [ +"2831a1cf090c3e87" +], +"minimum-area-rectangle-ii": [], +"minimum-array-changes-to-make-differences-equal": [], +"minimum-array-end": [], +"minimum-array-length-after-pair-removals": [], +"minimum-array-sum": [], +"minimum-ascii-delete-sum-for-two-strings": [], +"minimum-average-difference": [ +"0300485b032419d0" +], +"minimum-average-of-smallest-and-largest-elements": [ +"38b74840439b22f2" +], +"minimum-bit-flips-to-convert-number": [], +"minimum-changes-to-make-alternating-binary-string": [], +"minimum-changes-to-make-k-semi-palindromes": [], +"minimum-common-value": [], +"minimum-consecutive-cards-to-pick-up": [], +"minimum-cost-for-cutting-cake-i": [], +"minimum-cost-for-cutting-cake-ii": [ +"4f91eb199ff47633" +], +"minimum-cost-for-tickets": [], +"minimum-cost-good-caption": [], +"minimum-cost-homecoming-of-a-robot-in-a-grid": [ +"0496885e7fafeb81", +"f880497e851f3aed" +], +"minimum-cost-of-a-path-with-special-roads": [], +"minimum-cost-of-buying-candies-with-discount": [], +"minimum-cost-to-buy-apples": [], +"minimum-cost-to-change-the-final-value-of-expression": [ +"e1dd9c7489573368" +], +"minimum-cost-to-connect-sticks": [], +"minimum-cost-to-connect-two-groups-of-points": [], +"minimum-cost-to-convert-string-i": [ +"10855ebb921ceb9b", +"1d10c78738652fe2", +"2d83a3a64f2b6ac4", +"6111eec2b2982ea1", +"626303caf21d8940", +"63cee4e0e97e2094", +"b46f8496657e60b4", +"c85f719926b077fa", +"d154ed759b154fec", +"fd77ea2d229ec13b" +], +"minimum-cost-to-convert-string-ii": [], +"minimum-cost-to-cut-a-stick": [ +"a06dcfd2cefa23ae" +], +"minimum-cost-to-divide-array-into-subarrays": [], +"minimum-cost-to-equalize-array": [], +"minimum-cost-to-hire-k-workers": [], +"minimum-cost-to-make-all-characters-equal": [], +"minimum-cost-to-make-array-equal": [], +"minimum-cost-to-make-array-equalindromic": [], +"minimum-cost-to-make-arrays-identical": [], +"minimum-cost-to-make-at-least-one-valid-path-in-a-grid": [], +"minimum-cost-to-merge-stones": [], +"minimum-cost-to-move-chips-to-the-same-position": [], +"minimum-cost-to-reach-city-with-discounts": [], +"minimum-cost-to-reach-destination-in-time": [], +"minimum-cost-to-reach-every-position": [], +"minimum-cost-to-separate-sentence-into-rows": [], +"minimum-cost-to-set-cooking-time": [], +"minimum-cost-to-split-an-array": [ +"141c696b3adc1a31", +"14785029eb365f94", +"248fadc032a9a7b5", +"3cfdf26285dbb009", +"41d98db3eb9a1d59", +"76f9105fcd202d9f", +"7efd52d0aa5ee9e0", +"a8d9784028e03541", +"b02377513120626d", +"eaeab626cdb7a58f" +], +"minimum-cost-tree-from-leaf-values": [], +"minimum-cost-walk-in-weighted-graph": [], +"minimum-costs-using-the-train-line": [], +"minimum-cuts-to-divide-a-circle": [], +"minimum-degree-of-a-connected-trio-in-a-graph": [], +"minimum-deletions-to-make-array-beautiful": [], +"minimum-deletions-to-make-array-divisible": [], +"minimum-deletions-to-make-character-frequencies-unique": [], +"minimum-deletions-to-make-string-balanced": [], +"minimum-deletions-to-make-string-k-special": [], +"minimum-depth-of-binary-tree": [], +"minimum-difference-between-highest-and-lowest-of-k-scores": [], +"minimum-difference-between-largest-and-smallest-value-in-three-moves": [], +"minimum-difference-in-sums-after-removal-of-elements": [], +"minimum-difficulty-of-a-job-schedule": [], +"minimum-distance-between-bst-nodes": [], +"minimum-distance-to-the-target-element": [], +"minimum-distance-to-type-a-word-using-two-fingers": [], +"minimum-division-operations-to-make-array-non-decreasing": [], +"minimum-domino-rotations-for-equal-row": [ +"0cc7a3742908b259" +], +"minimum-edge-reversals-so-every-node-is-reachable": [], +"minimum-edge-weight-equilibrium-queries-in-a-tree": [], +"minimum-element-after-replacement-with-digit-sum": [], +"minimum-elements-to-add-to-form-a-given-sum": [], +"minimum-equal-sum-of-two-arrays-after-replacing-zeros": [], +"minimum-factorization": [], +"minimum-falling-path-sum": [ +"015139e29bc0c642", +"33a5d7a795899a79", +"7d8df3e498f0cc9e", +"7e98c04b8bf62abc", +"9716d1c5aab8887b" +], +"minimum-falling-path-sum-ii": [], +"minimum-flips-to-make-a-or-b-equal-to-c": [], +"minimum-fuel-cost-to-report-to-the-capital": [], +"minimum-garden-perimeter-to-collect-enough-apples": [], +"minimum-genetic-mutation": [], +"minimum-health-to-beat-game": [], +"minimum-height-trees": [], +"minimum-hours-of-training-to-win-a-competition": [], +"minimum-impossible-or": [], +"minimum-incompatibility": [], +"minimum-increment-operations-to-make-array-beautiful": [], +"minimum-increment-to-make-array-unique": [], +"minimum-increments-for-target-multiples-in-an-array": [], +"minimum-index-of-a-valid-split": [], +"minimum-index-sum-of-two-lists": [], +"minimum-initial-energy-to-finish-tasks": [], +"minimum-insertion-steps-to-make-a-string-palindrome": [], +"minimum-insertions-to-balance-a-parentheses-string": [], +"minimum-interval-to-include-each-query": [], +"minimum-jumps-to-reach-home": [], +"minimum-knight-moves": [ +"042a7e382616312f", +"0517996cd0b79387", +"1eade71beb0a5421", +"2236892efc0324e2", +"22e472849a25aa56", +"26db081efba2e1c7", +"425f24d291524c37", +"465bc993d5f0dd14", +"470c411a2764af27", +"4c44455a2f0989a4", +"4c99ede9577d0081", +"54c3a1f5ae31f1f8", +"6cc1b83a21d3650d", +"730d052964d83430", +"766eed8525ea6d53", +"8008e3cc15ed0d51", +"82121add0ddf0ee8", +"96145b4b7d5071d2", +"b16c5a058a40d72a", +"b746641c6c7afbaa", +"b7e73df1ab484fa7", +"bd8607aea9503e63", +"cabe3c34edf05e91", +"cd1b4794e09dc5d6", +"e557f4efb00ed759", +"ea1ae3fddfd7fae8" +], +"minimum-length-of-anagram-concatenation": [], +"minimum-length-of-string-after-deleting-similar-ends": [], +"minimum-length-of-string-after-operations": [], +"minimum-levels-to-gain-more-points": [], +"minimum-limit-of-balls-in-a-bag": [], +"minimum-lines-to-represent-a-line-chart": [], +"minimum-money-required-before-transactions": [], +"minimum-moves-to-capture-the-queen": [], +"minimum-moves-to-convert-string": [], +"minimum-moves-to-equal-array-elements": [], +"minimum-moves-to-equal-array-elements-ii": [], +"minimum-moves-to-get-a-peaceful-board": [], +"minimum-moves-to-make-array-complementary": [], +"minimum-moves-to-move-a-box-to-their-target-location": [ +"68b8d3a4373bbf18" +], +"minimum-moves-to-pick-k-ones": [], +"minimum-moves-to-reach-target-score": [], +"minimum-moves-to-reach-target-with-rotations": [], +"minimum-moves-to-spread-stones-over-grid": [ +"0750ffaf989a6e95", +"24ead0e47217eb46", +"340748dfdbceb642", +"7667a25f4ca7ce71", +"84d87aee9efc4ae2", +"8f5de59a8191dd5b", +"aaaa1d7d24b6fd40", +"ab1134f87c138033", +"bb2ca379836a8f52", +"bdfd2b218b010afb", +"f00c9b1b197fd759", +"f75621514cfea1a3", +"faafd5a90d8399d3" +], +"minimum-number-game": [], +"minimum-number-of-arrows-to-burst-balloons": [], +"minimum-number-of-chairs-in-a-waiting-room": [], +"minimum-number-of-changes-to-make-binary-string-beautiful": [], +"minimum-number-of-coins-for-fruits": [], +"minimum-number-of-coins-for-fruits-ii": [], +"minimum-number-of-coins-to-be-added": [], +"minimum-number-of-days-to-disconnect-island": [], +"minimum-number-of-days-to-eat-n-oranges": [], +"minimum-number-of-days-to-make-m-bouquets": [], +"minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix": [], +"minimum-number-of-flips-to-make-binary-grid-palindromic-i": [], +"minimum-number-of-flips-to-make-binary-grid-palindromic-ii": [], +"minimum-number-of-flips-to-make-the-binary-string-alternating": [], +"minimum-number-of-food-buckets-to-feed-the-hamsters": [], +"minimum-number-of-frogs-croaking": [], +"minimum-number-of-increasing-subsequence-to-be-removed": [], +"minimum-number-of-increments-on-subarrays-to-form-a-target-array": [], +"minimum-number-of-k-consecutive-bit-flips": [], +"minimum-number-of-keypresses": [ +"b53dc9f393341516" +], +"minimum-number-of-lines-to-cover-points": [], +"minimum-number-of-moves-to-make-palindrome": [], +"minimum-number-of-moves-to-seat-everyone": [], +"minimum-number-of-operations-to-convert-time": [ +"66e4db27adccace7", +"b70dfd1b3adae448", +"f9c8a68c4c8f68eb" +], +"minimum-number-of-operations-to-make-all-array-elements-equal-to-1": [], +"minimum-number-of-operations-to-make-array-continuous": [], +"minimum-number-of-operations-to-make-array-empty": [], +"minimum-number-of-operations-to-make-array-xor-equal-to-k": [], +"minimum-number-of-operations-to-make-arrays-similar": [ +"07895b458b8f0172", +"1678c076493330ef", +"1dc61e906cc613bb", +"26056025dcbf432e", +"2ff0ee8828f954a4", +"3af7eeeb59ab791b", +"3beace3f44b96501", +"3d9e3d9626a8add8", +"402e068a4c016cf9", +"402e068a4c016cf9", +"4724520803737275", +"4b43efc0a373ba36", +"4b43efc0a373ba36", +"508dfc82f3ac6340", +"53733bb3b8b8b8cb", +"578193fb6fe445c7", +"58651c88025462d1", +"66595648560c0301", +"6971b5ca395d1812", +"6a05350720674d63", +"7053691a6b0f9855", +"799e287a8321791b", +"7fc01d32db05d1f2", +"85a34061dec835fd", +"85a34061dec835fd", +"8a075a030d39ec1c", +"8bcf49bd6c1415d3", +"9a585b9512ebeb50", +"aa107a3a50a619da", +"aa107a3a50a619da", +"b42ec7e35da8a5a3", +"b6a83d573980f32d", +"b9c89eeb03742691", +"ba4bc3fcabcda99f", +"bc2e56e730240d26", +"c0573a767df3f83e", +"c084bdf3d3030309", +"c3f542e394573233", +"c817b860190055b1", +"ca87f96a37012112", +"d1d4ab2b85fa77ca", +"d4dcbb9006ffc221", +"d4dcbb9006ffc221", +"e28604fbfffa69f9", +"e3517b4a81ee1b09", +"e8fc60708ca60010", +"e98bc0d075a93c86", +"f9afc704a43ad907", +"ffefc0eaec43dae2" +], +"minimum-number-of-operations-to-make-elements-in-array-distinct": [], +"minimum-number-of-operations-to-make-word-k-periodic": [], +"minimum-number-of-operations-to-make-x-and-y-equal": [], +"minimum-number-of-operations-to-move-all-balls-to-each-box": [], +"minimum-number-of-operations-to-reinitialize-a-permutation": [], +"minimum-number-of-operations-to-satisfy-conditions": [], +"minimum-number-of-operations-to-sort-a-binary-tree-by-level": [], +"minimum-number-of-people-to-teach": [], +"minimum-number-of-pushes-to-type-word-i": [], +"minimum-number-of-pushes-to-type-word-ii": [], +"minimum-number-of-refueling-stops": [], +"minimum-number-of-removals-to-make-mountain-array": [], +"minimum-number-of-seconds-to-make-mountain-height-zero": [], +"minimum-number-of-steps-to-make-two-strings-anagram": [ +"6da7000100aae987" +], +"minimum-number-of-steps-to-make-two-strings-anagram-ii": [ +"8fcbd55cff881524", +"d2009ee70a1c07f0" +], +"minimum-number-of-swaps-to-make-the-binary-string-alternating": [], +"minimum-number-of-swaps-to-make-the-string-balanced": [], +"minimum-number-of-taps-to-open-to-water-a-garden": [ +"09917a3d3ba45383", +"2973e1f136ec760d", +"3548586abc817146", +"59182bfc0163bdff", +"7d76c15d1d74e3bb", +"b98acad2b487ec74", +"ca7e9ea11afe8877", +"ec115533300bd43f" +], +"minimum-number-of-valid-strings-to-form-target-i": [], +"minimum-number-of-valid-strings-to-form-target-ii": [], +"minimum-number-of-vertices-to-reach-all-nodes": [], +"minimum-number-of-visited-cells-in-a-grid": [], +"minimum-number-of-work-sessions-to-finish-the-tasks": [], +"minimum-numbers-of-function-calls-to-make-target-array": [], +"minimum-obstacle-removal-to-reach-corner": [], +"minimum-one-bit-operations-to-make-integers-zero": [], +"minimum-operations-to-collect-elements": [], +"minimum-operations-to-convert-number": [], +"minimum-operations-to-exceed-threshold-value-i": [], +"minimum-operations-to-exceed-threshold-value-ii": [], +"minimum-operations-to-form-subsequence-with-target-sum": [], +"minimum-operations-to-halve-array-sum": [], +"minimum-operations-to-make-a-special-number": [], +"minimum-operations-to-make-a-subsequence": [], +"minimum-operations-to-make-a-uni-value-grid": [], +"minimum-operations-to-make-all-array-elements-equal": [], +"minimum-operations-to-make-array-elements-zero": [ +"9bc119fbf156a822", +"a248ebd57ae0e432", +"a248ebd57ae0e432", +"e7c9b1b9fb792562" +], +"minimum-operations-to-make-array-equal": [], +"minimum-operations-to-make-array-equal-ii": [], +"minimum-operations-to-make-array-equal-to-target": [], +"minimum-operations-to-make-array-values-equal-to-k": [], +"minimum-operations-to-make-binary-array-elements-equal-to-one-i": [], +"minimum-operations-to-make-binary-array-elements-equal-to-one-ii": [], +"minimum-operations-to-make-character-frequencies-equal": [], +"minimum-operations-to-make-columns-strictly-increasing": [], +"minimum-operations-to-make-elements-within-k-subarrays-equal": [], +"minimum-operations-to-make-median-of-array-equal-to-k": [], +"minimum-operations-to-make-numbers-non-positive": [], +"minimum-operations-to-make-subarray-elements-equal": [], +"minimum-operations-to-make-the-array-alternating": [], +"minimum-operations-to-make-the-array-increasing": [], +"minimum-operations-to-make-the-array-k-increasing": [], +"minimum-operations-to-make-the-integer-zero": [], +"minimum-operations-to-maximize-last-elements-in-arrays": [], +"minimum-operations-to-reduce-an-integer-to-0": [], +"minimum-operations-to-reduce-x-to-zero": [], +"minimum-operations-to-remove-adjacent-ones-in-matrix": [], +"minimum-operations-to-write-the-letter-y-on-a-grid": [ +"69c4f413478923cd", +"e18f8fb8107cc3a4", +"e2eeeb6f1e8a8a6b" +], +"minimum-path-cost-in-a-grid": [], +"minimum-path-sum": [], +"minimum-penalty-for-a-shop": [], +"minimum-positive-sum-subarray": [], +"minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits": [], +"minimum-processing-time": [ +"0734fe7dd5a52f28", +"0b3895d44acd3dc0", +"0fd4b154f145ce62", +"126dab41e6023db8", +"12c1d2a54cd9daae", +"22fa4b44928b3756", +"23f3e6a9d69477a7", +"25aa5a09a4dab7a6", +"279177a04ebfa661", +"2c70eb4ff9e1a501", +"2d71763af4d3f5a9", +"320c55f1b001bfb8", +"3bae25dcbe1cb7ce", +"460305e1899c12a1", +"4948651d69e68c00", +"4e3a1f188d2d8e17", +"51d3d48d41d0a396", +"5424caa024637974", +"681b34f42105dab1", +"6eb1b90090de7f16", +"774489336a3193eb", +"8cfb9df80ac99753", +"8ddf488fd4e26f73", +"918a692cd625be32", +"95d129ba5e77f753", +"9a4fc0da323b33c9", +"9d89dd5c20def4ad", +"9e271354ce07e737", +"a38485de578b8055", +"b3020347042a43bd", +"c7a8e3310545d41a", +"c808e9a8d7ea1849", +"d3065c826b9295b9", +"d45a8aa0137b720a", +"d9914619afe7b2d9", +"d9e2118b6bc40634", +"dd45833c626f29d3", +"f03adcc96f48deb6", +"f7df123f9a2c5e7f", +"fc676d4f739621b1" +], +"minimum-recolors-to-get-k-consecutive-black-blocks": [], +"minimum-rectangles-to-cover-points": [], +"minimum-relative-loss-after-buying-chocolates": [], +"minimum-remove-to-make-valid-parentheses": [], +"minimum-replacements-to-sort-the-array": [], +"minimum-right-shifts-to-sort-the-array": [], +"minimum-rounds-to-complete-all-tasks": [], +"minimum-runes-to-add-to-cast-spell": [ +"1be22291827bd364", +"c2e74d13a3a5a932" +], +"minimum-score-after-removals-on-a-tree": [], +"minimum-score-by-changing-two-elements": [], +"minimum-score-of-a-path-between-two-cities": [], +"minimum-score-triangulation-of-polygon": [ +"970aab07db77f509", +"e3056c2b57f4e520" +], +"minimum-seconds-to-equalize-a-circular-array": [], +"minimum-sideway-jumps": [], +"minimum-size-subarray-in-infinite-array": [], +"minimum-size-subarray-sum": [], +"minimum-skips-to-arrive-at-meeting-on-time": [], +"minimum-space-wasted-from-packaging": [], +"minimum-speed-to-arrive-on-time": [], +"minimum-split-into-subarrays-with-gcd-greater-than-one": [], +"minimum-string-length-after-removing-substrings": [], +"minimum-subarrays-in-a-valid-split": [], +"minimum-subsequence-in-non-increasing-order": [], +"minimum-substring-partition-of-equal-character-frequency": [], +"minimum-suffix-flips": [], +"minimum-sum-of-four-digit-number-after-splitting-digits": [], +"minimum-sum-of-mountain-triplets-i": [], +"minimum-sum-of-mountain-triplets-ii": [], +"minimum-sum-of-squared-difference": [], +"minimum-sum-of-values-by-dividing-array": [], +"minimum-swaps-to-arrange-a-binary-grid": [], +"minimum-swaps-to-group-all-1s-together": [], +"minimum-swaps-to-group-all-1s-together-ii": [], +"minimum-swaps-to-make-sequences-increasing": [], +"minimum-swaps-to-make-strings-equal": [], +"minimum-time-difference": [], +"minimum-time-for-k-virus-variants-to-spread": [], +"minimum-time-takes-to-reach-destination-without-drowning": [], +"minimum-time-to-break-locks-i": [], +"minimum-time-to-build-blocks": [], +"minimum-time-to-complete-all-tasks": [], +"minimum-time-to-complete-trips": [], +"minimum-time-to-eat-all-grains": [], +"minimum-time-to-finish-the-race": [ +"0c82f2ed65b674a6" +], +"minimum-time-to-kill-all-monsters": [], +"minimum-time-to-make-array-sum-at-most-x": [], +"minimum-time-to-make-rope-colorful": [], +"minimum-time-to-remove-all-cars-containing-illegal-goods": [], +"minimum-time-to-repair-cars": [], +"minimum-time-to-revert-word-to-initial-state-i": [], +"minimum-time-to-revert-word-to-initial-state-ii": [], +"minimum-time-to-type-word-using-special-typewriter": [], +"minimum-time-to-visit-a-cell-in-a-grid": [], +"minimum-time-to-visit-disappearing-nodes": [], +"minimum-time-visiting-all-points": [], +"minimum-total-cost-to-make-arrays-unequal": [ +"a48f93ad752e4ea3", +"c806b39faa2e0817" +], +"minimum-total-distance-traveled": [], +"minimum-total-operations": [], +"minimum-total-space-wasted-with-k-resizing-operations": [ +"00460bb2cf742204", +"820e8c4225c18678" +], +"minimum-unique-word-abbreviation": [], +"minimum-unlocked-indices-to-sort-nums": [], +"minimum-value-to-get-positive-step-by-step-sum": [], +"minimum-weighted-subgraph-with-the-required-paths": [], +"minimum-white-tiles-after-covering-with-carpets": [], +"minimum-window-subsequence": [], +"minimum-window-substring": [], +"minimum-xor-sum-of-two-arrays": [ +"4cd05b889f9de2a1" +], +"mirror-reflection": [], +"missing-element-in-sorted-array": [], +"missing-number": [], +"missing-number-in-arithmetic-progression": [], +"missing-ranges": [], +"modify-graph-edge-weights": [], +"modify-the-matrix": [], +"monotone-increasing-digits": [], +"monotonic-array": [], +"most-beautiful-item-for-each-query": [], +"most-expensive-item-that-can-not-be-bought": [], +"most-frequent-even-element": [], +"most-frequent-ids": [], +"most-frequent-number-following-key-in-an-array": [ +"a62b3870025ab9bd" +], +"most-frequent-prime": [], +"most-frequent-subtree-sum": [], +"most-popular-video-creator": [], +"most-profit-assigning-work": [], +"most-profitable-path-in-a-tree": [], +"most-stones-removed-with-same-row-or-column": [], +"most-visited-sector-in-a-circular-track": [], +"move-pieces-to-obtain-a-string": [], +"movement-of-robots": [ +"172280b9791a3fd0", +"24a8259062826c9d", +"2be6e072c8b849f3", +"2f9f3f7e68c7a7d0", +"897e95af5f0a8694", +"9220ec3b36b8ac16", +"c16c3c29a20012b6", +"d79a7a84e8a95825", +"daf179a849777207" +], +"moving-stones-until-consecutive": [], +"moving-stones-until-consecutive-ii": [], +"multiply-strings": [], +"n-queens": [], +"n-queens-ii": [], +"n-repeated-element-in-size-2n-array": [], +"n-th-tribonacci-number": [], +"naming-a-company": [], +"nearest-exit-from-entrance-in-maze": [], +"neighboring-bitwise-xor": [], +"neither-minimum-nor-maximum": [], +"network-delay-time": [], +"new-21-game": [], +"next-closest-time": [], +"next-greater-element-i": [], +"next-greater-element-ii": [], +"next-greater-element-iii": [], +"next-greater-element-iv": [], +"next-greater-node-in-linked-list": [], +"next-greater-numerically-balanced-number": [], +"next-palindrome-using-same-digits": [], +"nim-game": [], +"node-with-highest-edge-score": [], +"non-decreasing-array": [], +"non-decreasing-subsequences": [], +"non-negative-integers-without-consecutive-ones": [], +"non-overlapping-intervals": [], +"nth-digit": [], +"nth-magical-number": [ +"300d259bd86ee010", +"490c56a4ac76655e", +"54b18d5fda4924dc", +"76a8b139464eaa20", +"93e306f22a813477", +"9c181fbf4f70d360", +"b782680be9cd0e57", +"cdd847fb236c3c40" +], +"number-complement": [], +"number-of-1-bits": [], +"number-of-adjacent-elements-with-the-same-color": [], +"number-of-arithmetic-triplets": [], +"number-of-atoms": [], +"number-of-beautiful-integers-in-the-range": [ +"2367bf856f0e75dc" +], +"number-of-beautiful-pairs": [], +"number-of-beautiful-partitions": [], +"number-of-bit-changes-to-make-two-integers-equal": [], +"number-of-black-blocks": [], +"number-of-boomerangs": [], +"number-of-burgers-with-no-waste-of-ingredients": [], +"number-of-changing-keys": [], +"number-of-closed-islands": [], +"number-of-common-factors": [], +"number-of-connected-components-in-an-undirected-graph": [], +"number-of-corner-rectangles": [], +"number-of-days-between-two-dates": [], +"number-of-days-in-a-month": [], +"number-of-dice-rolls-with-target-sum": [], +"number-of-different-integers-in-a-string": [], +"number-of-different-subsequences-gcds": [], +"number-of-digit-one": [], +"number-of-distinct-averages": [], +"number-of-distinct-islands": [], +"number-of-distinct-islands-ii": [], +"number-of-distinct-roll-sequences": [], +"number-of-distinct-substrings-in-a-string": [], +"number-of-divisible-substrings": [], +"number-of-divisible-triplet-sums": [], +"number-of-employees-who-met-the-target": [], +"number-of-enclaves": [], +"number-of-equal-count-substrings": [], +"number-of-equivalent-domino-pairs": [ +"dd30fc3b48c3b1f5" +], +"number-of-even-and-odd-bits": [], +"number-of-excellent-pairs": [], +"number-of-flowers-in-full-bloom": [], +"number-of-good-binary-strings": [], +"number-of-good-leaf-nodes-pairs": [], +"number-of-good-pairs": [], +"number-of-good-paths": [], +"number-of-good-ways-to-split-a-string": [], +"number-of-great-partitions": [], +"number-of-increasing-paths-in-a-grid": [], +"number-of-islands": [], +"number-of-islands-ii": [], +"number-of-laser-beams-in-a-bank": [], +"number-of-lines-to-write-string": [], +"number-of-longest-increasing-subsequence": [], +"number-of-matching-subsequences": [], +"number-of-music-playlists": [], +"number-of-nodes-in-the-sub-tree-with-the-same-label": [], +"number-of-nodes-with-value-one": [ +"570b9d3eea45f56c", +"a55775b0426d2791" +], +"number-of-operations-to-make-network-connected": [], +"number-of-orders-in-the-backlog": [], +"number-of-pairs-of-interchangeable-rectangles": [], +"number-of-pairs-of-strings-with-concatenation-equal-to-target": [], +"number-of-pairs-satisfying-inequality": [], +"number-of-paths-with-max-score": [], +"number-of-people-aware-of-a-secret": [], +"number-of-people-that-can-be-seen-in-a-grid": [], +"number-of-possible-sets-of-closing-branches": [], +"number-of-provinces": [], +"number-of-rectangles-that-can-form-the-largest-square": [], +"number-of-restricted-paths-from-first-to-last-node": [], +"number-of-same-end-substrings": [], +"number-of-self-divisible-permutations": [], +"number-of-senior-citizens": [], +"number-of-sets-of-k-non-overlapping-line-segments": [], +"number-of-single-divisor-triplets": [ +"164baa606d3acf2f", +"1a806c1b82ad8d68", +"1bbee11a17426a59", +"1db780d6a6fd95c3", +"2a978d862eedd49e", +"2d0b22e95d17ddda", +"3787082994d27710", +"41e7059e884c38f8", +"49e47928571e2128", +"517cf72d39cdd608", +"5a207bcbc90328a3", +"5a8a6b41ca3fe0e8", +"6a491d0e647be997", +"6a491d0e647be997", +"6bf0c97f21a8bd35", +"6c89f51d05c52901", +"8c4aeeaf214ea254", +"9063ac310b0ae72e", +"92c041f2c8753bdb", +"9ce3a052148f772f", +"abddad93982f500f", +"abddad93982f500f", +"b240485cf4c82c17", +"b4766caea13dc502", +"b48ba6107f43bd64", +"c0fd27a2e36b9966", +"cb6dcbd223bd8dcc", +"d6302b9ab902f2c4", +"d6302b9ab902f2c4", +"eec4c7c37dcd2c29", +"f145526770f805ee", +"f24c3608240693ed", +"f24c3608240693ed" +], +"number-of-smooth-descent-periods-of-a-stock": [], +"number-of-spaces-cleaning-robot-cleaned": [], +"number-of-squareful-arrays": [], +"number-of-steps-to-reduce-a-number-in-binary-representation-to-one": [], +"number-of-steps-to-reduce-a-number-to-zero": [], +"number-of-strings-that-appear-as-substrings-in-word": [], +"number-of-strings-which-can-be-rearranged-to-contain-substring": [], +"number-of-students-doing-homework-at-a-given-time": [], +"number-of-students-unable-to-eat-lunch": [], +"number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold": [], +"number-of-sub-arrays-with-odd-sum": [], +"number-of-subarrays-having-even-product": [], +"number-of-subarrays-that-match-a-pattern-i": [], +"number-of-subarrays-that-match-a-pattern-ii": [], +"number-of-subarrays-with-and-value-of-k": [], +"number-of-subarrays-with-bounded-maximum": [], +"number-of-subarrays-with-gcd-equal-to-k": [], +"number-of-subarrays-with-lcm-equal-to-k": [], +"number-of-submatrices-that-sum-to-target": [], +"number-of-subsequences-that-satisfy-the-given-sum-condition": [], +"number-of-subsequences-with-odd-sum": [], +"number-of-substrings-containing-all-three-characters": [], +"number-of-substrings-with-fixed-ratio": [], +"number-of-substrings-with-only-1s": [], +"number-of-times-binary-string-is-prefix-aligned": [], +"number-of-unequal-triplets-in-array": [], +"number-of-unique-flavors-after-sharing-k-candies": [], +"number-of-unique-good-subsequences": [], +"number-of-valid-clock-times": [], +"number-of-valid-move-combinations-on-chessboard": [], +"number-of-valid-subarrays": [], +"number-of-valid-words-for-each-puzzle": [ +"21491eaa16ab3893", +"efb0d86e9a8d10dd" +], +"number-of-valid-words-in-a-sentence": [], +"number-of-visible-people-in-a-queue": [], +"number-of-ways-of-cutting-a-pizza": [ +"812665e177035afa", +"ff31f323b7486f77" +], +"number-of-ways-to-arrive-at-destination": [], +"number-of-ways-to-build-house-of-cards": [], +"number-of-ways-to-build-sturdy-brick-wall": [], +"number-of-ways-to-buy-pens-and-pencils": [], +"number-of-ways-to-divide-a-long-corridor": [], +"number-of-ways-to-earn-points": [], +"number-of-ways-to-form-a-target-string-given-a-dictionary": [ +"1395698abec18f3c", +"23410f0841c524a0", +"29fbd6334386d812", +"6d86c9d256933e90", +"d556d17825285d27" +], +"number-of-ways-to-paint-n-3-grid": [], +"number-of-ways-to-reach-a-position-after-exactly-k-steps": [], +"number-of-ways-to-reach-destination-in-the-grid": [], +"number-of-ways-to-rearrange-sticks-with-k-sticks-visible": [], +"number-of-ways-to-reconstruct-a-tree": [], +"number-of-ways-to-reorder-array-to-get-same-bst": [], +"number-of-ways-to-select-buildings": [], +"number-of-ways-to-separate-numbers": [], +"number-of-ways-to-split-a-string": [], +"number-of-ways-to-split-array": [], +"number-of-ways-to-stay-in-the-same-place-after-some-steps": [], +"number-of-ways-to-wear-different-hats-to-each-other": [], +"number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers": [], +"number-of-wonderful-substrings": [ +"451c51b218d646b3", +"a8f42d4ef2087678" +], +"number-of-zero-filled-subarrays": [], +"numbers-at-most-n-given-digit-set": [], +"numbers-with-repeated-digits": [], +"numbers-with-same-consecutive-differences": [], +"occurrences-after-bigram": [], +"odd-even-jump": [], +"odd-even-linked-list": [], +"odd-string-difference": [ +"11967dab02ec41da", +"1772a86a355a8829", +"1c419b5e1296488f", +"3d821e1d23a94bf5", +"3f98b7960a9b79a4", +"44bf73b868862e80", +"518c0bbcf58b4702", +"574cc2cf89e24bba", +"5aa8c10b3f8635b2", +"6fd56cac07d1035c", +"7687000b921d2843", +"78b0558315f75e52", +"7e4aef485ee34aa3", +"87fd44055b1ca246", +"8d93fde6368459ac", +"92b5a1486139fcb9", +"a4f7214fad8cec50", +"aae6e7bfccb07262", +"ad7900bd97a40dbe", +"b10c4e947ef27b46", +"b55668b00138eb6f", +"c2f6ef98252897b7", +"ed1e3e16ddacc07c", +"f05594f193169ba1", +"f7361ad06806ac55", +"fa1529e5243eb2a2" +], +"one-edit-distance": [], +"ones-and-zeroes": [], +"open-the-lock": [ +"975ba31c1d280505" +], +"optimal-account-balancing": [ +"47ac2b318a549f25", +"4de58c3390331aff", +"8213c5971cc4afc4" +], +"optimal-division": [], +"optimal-partition-of-string": [], +"optimize-water-distribution-in-a-village": [], +"orderly-queue": [], +"out-of-boundary-paths": [], +"output-contest-matches": [], +"paint-fence": [], +"paint-house": [], +"paint-house-ii": [], +"paint-house-iii": [], +"paint-house-iv": [], +"painting-a-grid-with-three-different-colors": [], +"painting-the-walls": [], +"pairs-of-songs-with-total-durations-divisible-by-60": [], +"palindrome-linked-list": [], +"palindrome-number": [], +"palindrome-pairs": [], +"palindrome-partitioning": [], +"palindrome-partitioning-ii": [], +"palindrome-partitioning-iii": [], +"palindrome-partitioning-iv": [], +"palindrome-permutation": [ +"5b65f18279c34092", +"9b8d4ddc929581ec" +], +"palindrome-permutation-ii": [], +"palindrome-rearrangement-queries": [ +"6c4cca3c077c28ef", +"ec91e331fa9c8849" +], +"palindrome-removal": [], +"palindromic-substrings": [], +"pancake-sorting": [], +"parallel-courses": [], +"parallel-courses-ii": [], +"parallel-courses-iii": [], +"parse-lisp-expression": [], +"parsing-a-boolean-expression": [ +"47f7180c332cf474", +"680e386d9469691b" +], +"partition-array-according-to-given-pivot": [], +"partition-array-for-maximum-sum": [], +"partition-array-into-disjoint-intervals": [], +"partition-array-into-three-parts-with-equal-sum": [], +"partition-array-into-two-arrays-to-minimize-sum-difference": [], +"partition-array-such-that-maximum-difference-is-k": [], +"partition-equal-subset-sum": [], +"partition-labels": [], +"partition-list": [], +"partition-string-into-minimum-beautiful-substrings": [], +"partition-string-into-substrings-with-values-at-most-k": [], +"partition-to-k-equal-sum-subsets": [], +"partitioning-into-minimum-number-of-deci-binary-numbers": [], +"pascals-triangle": [], +"pascals-triangle-ii": [], +"pass-the-pillow": [], +"patching-array": [], +"path-crossing": [], +"path-in-zigzag-labelled-binary-tree": [ +"8f5cc3d3dc5cbc1a" +], +"path-sum": [], +"path-sum-ii": [], +"path-sum-iii": [], +"path-sum-iv": [], +"path-with-maximum-gold": [], +"path-with-maximum-minimum-value": [], +"path-with-maximum-probability": [ +"6b800aaada14618d", +"93dc887ff6eb3cea", +"c666f711d564d67e", +"faf57479e830e25f" +], +"path-with-minimum-effort": [], +"paths-in-matrix-whose-sum-is-divisible-by-k": [], +"paths-in-maze-that-lead-to-same-room": [], +"peak-index-in-a-mountain-array": [], +"peaks-in-array": [], +"people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list": [], +"percentage-of-letter-in-string": [], +"perfect-number": [], +"perfect-rectangle": [], +"perfect-squares": [], +"perform-string-shifts": [], +"permutation-difference-between-two-strings": [ +"278420e63f9d94f6", +"29c00617cfd5fca9", +"401a65130cf73721", +"7b0026a3cf1bcfbb", +"a6f82fa1aa62c7cb", +"ba08a5408b3e25a3", +"bfbc6fbbd137f5db", +"c2ad1e55d488f0a0", +"ec2b37c7ca78e747", +"ed5b75cb5e5b1d01" +], +"permutation-in-string": [], +"permutation-sequence": [], +"permutations": [], +"permutations-ii": [], +"permutations-iii": [], +"permutations-iv": [], +"phone-number-prefix": [], +"pizza-with-3n-slices": [], +"plates-between-candles": [], +"plus-one": [], +"plus-one-linked-list": [], +"points-that-intersect-with-cars": [], +"poor-pigs": [], +"positions-of-large-groups": [], +"possible-bipartition": [], +"pour-water": [], +"pour-water-between-buckets-to-make-water-levels-equal": [], +"power-of-four": [], +"power-of-heroes": [], +"power-of-three": [], +"power-of-two": [], +"powerful-integers": [], +"powx-n": [], +"predict-the-winner": [], +"preimage-size-of-factorial-zeroes-function": [ +"8f5cc3d3dc5cbc1a" +], +"previous-permutation-with-one-swap": [], +"prime-arrangements": [], +"prime-in-diagonal": [], +"prime-number-of-set-bits-in-binary-representation": [], +"prime-pairs-with-target-sum": [], +"prime-palindrome": [], +"prime-subtraction-operation": [], +"print-binary-tree": [], +"print-words-vertically": [ +"03ed24db3b88e043", +"0ecef90300c8de53", +"364782ce7016053a", +"6d1f42c9ffbeac85", +"76bee94027f6cc31", +"77fc87dee2328c27", +"9b74f9e358df611e", +"b4ae93402ab4381c" +], +"prison-cells-after-n-days": [], +"probability-of-a-two-boxes-having-the-same-number-of-distinct-balls": [], +"process-restricted-friend-requests": [], +"process-tasks-using-servers": [], +"product-of-array-except-self": [], +"product-of-two-run-length-encoded-arrays": [], +"profitable-schemes": [], +"projection-area-of-3d-shapes": [], +"properties-graph": [], +"push-dominoes": [], +"put-boxes-into-the-warehouse-i": [], +"put-boxes-into-the-warehouse-ii": [], +"put-marbles-in-bags": [], +"pyramid-transition-matrix": [ +"0e10aa49f515313f", +"2240191007483c35", +"330e712caa1a7777", +"333c945949dbbf11", +"33d2b55906012956", +"390ce48306c03085", +"406a21e3e47da8c9", +"4ce96fb188c127ef", +"5b6ee88fb8d446b0", +"61a08fa9891c507e", +"7dacdd94602427bc", +"821a0f159ac933f8", +"86379358f890f817", +"8af6e86277d4b1dd", +"8b8647e9db399af0", +"8d1af797ee52128e", +"942ed53ef17efdf5", +"9ad68e86c1d69936", +"9cd3340c6451f470", +"a652b3d3f74c274b", +"a6b722150f1f11a7", +"c6a52bb2f833bf9f", +"c7c30aeed663caf7", +"c9f2953da07809ee", +"cb263f8520bbc55d", +"d42978976076a7c2", +"d4c7704a3fd27826", +"d5021d7f1fc8b8db", +"dfe9e5c41195eaed", +"ef74052414c02dca" +], +"queens-that-can-attack-the-king": [], +"queries-on-a-permutation-with-key": [], +"queries-on-number-of-points-inside-a-circle": [], +"query-kth-smallest-trimmed-number": [ +"0147c7b3a3d7ee20", +"12d4f690e13e8e26", +"3ad7b5f362c26d72", +"423a66f34004f60b", +"5b65ef0a03d97eec", +"a7d4dc0677d03acd", +"b138f8805d8d9a1f", +"e1fb58589db085ec" +], +"queue-reconstruction-by-height": [ +"0e145b1debe726a2", +"2d63bbd889d46b49", +"32bb34aac72aa499", +"3ad0e66d4ffdf50b", +"62025eca1462ad58", +"62550fa808faebd0", +"65b1643cee9790e9", +"66a27caf3cb0cb2c", +"6958c6d8d748d3a4", +"6b199c88e5bdc1c5", +"76e76a89a0511a4b", +"84bc27b6e0c6c5e9", +"8a1125b49ecc38a7", +"8aa1734cd92942e8", +"8fb85dda77a37aa4", +"998a29ad307a5161", +"9b78e293cdb0b6f4", +"9f01e29fb6e8f988", +"9f320920b44e7d90", +"9fd6555e6fd7c9d9", +"a8e1c41bc33a632a", +"ab64bad60b4556e9", +"b129c091fc67c82f", +"b5b1b47ac533c525", +"c12c7eaba49323be", +"c2bc20b1f3768b24", +"c3374ea3abf50897", +"c9ff3fdedbb9c746", +"cb125bfeec83eb9f", +"d61ff0f0aace3348", +"e20c24e500574c9b", +"f02a72d116af35d1", +"f45501a7cd61b240" +], +"rabbits-in-forest": [], +"race-car": [], +"range-addition": [ +"594278649dfd2416", +"727ec0259ad74189", +"a380fdf0acb8d1d1", +"caddcf470cb29034", +"e3d2ca770eeff83a" +], +"range-addition-ii": [], +"range-product-queries-of-powers": [ +"03ff71c699aae7ef", +"2126c59495e76c3a", +"2a216f8062b56b1f", +"327634f9ee065c59", +"3c405fe21a2107e5", +"3cb84b626cc37b3a", +"3d41dc3b3480708a", +"48ea4ee890ab2d6b", +"526de68ff6acd09f", +"52c167c7607c3bca", +"54f913740c0245aa", +"57623d3d064debbf", +"5d2257e2eff34bdd", +"6358a21c0b51015f", +"67219e69c12a629d", +"68344ab6353252da", +"6e1b42f1553909e4", +"71326c64a83b39c7", +"7fb41eec41f6eb48", +"8ecd2f18d32bfc57", +"a86bf49539a54af8", +"d034db09abc740dc", +"d66dcf030e1e9e06", +"e157f38d06402058", +"f56bf7fe58061bc7", +"f7536549be409cd8", +"fcb405886387c143" +], +"range-sum-of-bst": [], +"range-sum-of-sorted-subarray-sums": [ +"177cd1176882d268", +"177cd1176882d268", +"27596ab463619aa9", +"2edd8719a16553a4", +"370fd2ae3b995cf1", +"3ccfb320236b2acf", +"42380c946a3ab9b7", +"5972b4edb67a7e85", +"5a8391903891d9db", +"650cc89c9911a4a3", +"6cab92fad95eec35", +"775c4f436ad9c10a", +"7f77e79918007796", +"82f3162764128a50", +"832b81d5f18bfeb5", +"838a638c576c53d3", +"8f19920ca621d31a", +"a34614f5a0a68b7f", +"aa8f3aaff3634ebe", +"ac71578c78f92e6c", +"b41781a00ea66abd", +"c4b5771661fb3779", +"cdd72ad6f95ab85f", +"ce150bcb59a944aa", +"d5ac8518bc3c0fba", +"e975032ee1c96168", +"ed35da94c8c9a018", +"ede6b841072d742a" +], +"rank-teams-by-votes": [ +"15d23963a4a8652d", +"26edf9b482d5cdfb", +"2f3cefcf01c5be12", +"4aad3fc2c349773a", +"642c79475441970a", +"68e3d1d7c39431d2", +"74800bd72df98990", +"daeecb3ebe08b09e", +"fcf96f19f1dc5a54" +], +"rank-transform-of-a-matrix": [], +"rank-transform-of-an-array": [], +"ransom-note": [ +"c2978107bb31c6a4", +"fcf9602f82c7e758" +], +"reach-a-number": [ +"777bbfb99b4c6c66" +], +"reach-end-of-array-with-max-score": [], +"reachable-nodes-in-subdivided-graph": [], +"reachable-nodes-with-restrictions": [], +"reaching-points": [], +"rearrange-array-elements-by-sign": [], +"rearrange-array-to-maximize-prefix-score": [], +"rearrange-characters-to-make-target-string": [], +"rearrange-k-substrings-to-form-target-string": [ +"0dbfb2d557ba3ceb", +"0fb755e23344c41c", +"3fbd732f696b96b5", +"4884dc33fbb4d348", +"4cbb8665b2be42ac", +"57790a5bd2b0d899", +"7e629420fe58b038", +"903f72760cb9083c", +"968d813236056f73", +"b002df53c372c207", +"bbb9f186d9c3cf6d", +"d1efc2b28ab6d1d4" +], +"rearrange-spaces-between-words": [ +"89d634c685b2c6dc" +], +"rearrange-string-k-distance-apart": [], +"rearrange-words-in-a-sentence": [ +"2e3525cdc482c68f", +"4663888a8b1104cb" +], +"rearranging-fruits": [], +"reconstruct-a-2-row-binary-matrix": [], +"reconstruct-itinerary": [], +"reconstruct-original-digits-from-english": [], +"recover-a-tree-from-preorder-traversal": [ +"00ed2d924f3259d4", +"0118ab826716534e", +"089ec906f3b388ea", +"09321c8ea28ed2f1", +"095f8dd1ebd3bea2", +"0bbe2c9e07912b88", +"0f292eb47eecb7b1", +"10f71a81da4e7cbd", +"129eb183f65f60c8", +"15a28b3c08162b9e", +"167f9f1e3ba83de4", +"19936e58e8066d7e", +"1b07720dc4009ee9", +"1b574cc28377d3e9", +"1c608dce9a0c2f4b", +"1cb1b32715ba0ef0", +"1ddd749662e7264f", +"1fe54dff2964504d", +"209975a8ad61d22c", +"211d22f673906c5a", +"2250d3fa9a0619e5", +"23850b782b7f47f8", +"24151bfabfe7db7e", +"2511c140301430f4", +"253548a527bb7016", +"26cd6c3d372c26e4", +"2b4cdc6b72024187", +"2c1f7f647251972c", +"323738ff8490bc7a", +"331435d081132da1", +"336e5cd101d59a0c", +"357086c05f156109", +"35a4b3dd9caf5727", +"35a90ad78daee4e0", +"369c5e98bef8b6e3", +"388688b4d503c3b9", +"39ff95a2ba814f2e", +"3a8b92a78d33eb21", +"3ac8e18b422904f9", +"3b8f4790bfef2cb8", +"3e3d70e7874dcae6", +"3f0aaae2858f439f", +"3f3dc65f3adeb565", +"402458db95f8e079", +"402944eec7dec373", +"41e5c67829c3ef38", +"42164f8d209f8711", +"428c3e39824b5ec4", +"43f6f790880c14cf", +"4562e395f531640d", +"45e46c90a07a09f5", +"482b41b4e3d6064e", +"49bd80e7e9295bdb", +"4c8111e6b650bd0c", +"4cbf2eb90419f8d5", +"4d98ba9abfacbc77", +"4d9e53f3f3abd410", +"4e419b4e5247a724", +"5418ebc2d534133c", +"54c3e9432d1ed1c5", +"5556e73eb0fcb002", +"562eb10e202b16a2", +"58ce69725e719ae6", +"597bd6e5ad24ba54", +"5cdd167595a8f4a4", +"5ebfe5890acee206", +"629b7f7f9eabdda0", +"66de09818b6ee3d5", +"68fd6b2565b12d4b", +"6b0f42042ddfda34", +"6b84c8b50921bae1", +"701e6ac8654728b9", +"70ca6ffb81bf8528", +"730e6b93ad08fe01", +"735fae23964e8be7", +"77cf53874c8a41aa", +"7859a6bd4e536b8e", +"7be9cfe60c7f0b30", +"7d5f678c6ce29c46", +"82706e76f21790d6", +"83afa37480a3e64d", +"83bbbddc3d5dde8d", +"85772d9d99a4e532", +"880638e40e83ac10", +"8866e6cfaab07d02", +"8a2a37d4a9edf488", +"8a31cd10f7f76649", +"8cfce0bb64ad2108", +"8f320fe161b28dbc", +"906c056d7265cafc", +"91e57ac2a46192bf", +"92e4b9df246c1a63", +"950ce6e00a91a21f", +"9672a0eb0a9652ad", +"9d22f7fc9518c2c8", +"9e20431d6eb907eb", +"9eb53c611e0b2bc3", +"9fc790156eebef05", +"a2c3e11df0807226", +"a42ede6250c31f2f", +"a45b0558f0bc2d37", +"a58274ace684c985", +"a69a143461da9b6c", +"a6f357cb6e0418a6", +"a8182d31fbe899bb", +"abe45529d530d047", +"abfb06de6201d39a", +"ad71b86ec504b928", +"adb78f50941580fa", +"af47da7186a903c3", +"b0b6879f7d8feb86", +"b10b05f3f03e02b4", +"b1516d0208b76680", +"b426dc21f606b902", +"b5cc03cfbd502766", +"b6fdb22d2901eee8", +"b888f0a25ec53263", +"bace903fc4c2185b", +"bb2ff497d4c47e16", +"bddd3e03041d966d", +"bfe4a1cebc34f7a2", +"c2901099350c7716", +"c332de2d2d528815", +"c4757406dfe9bde4", +"c6990f1b25626638", +"ca4930eb59dbfdfa", +"cdcd0cf0975480bc", +"cdec3cd23dc4ecb0", +"ce17de6019189e86", +"ce92347d05ebc6db", +"cf22c64783cc2913", +"d0075e1f255870a6", +"d314a5db26c5b969", +"d438a382cfd918e1", +"d541ec54d90bdda6", +"d552489dd4f2ee74", +"d887b5c76594f8c5", +"da6cae1929782b21", +"dd524a36a2829ae6", +"e08e6a1d13d05277", +"e2470ff18b9c875c", +"e273292dda1ef544", +"e36898b4c93e4489", +"e400573d14421af2", +"e5870e8a652c21cd", +"e9ef52ccdeda2b48", +"ecaabe07042fc4db", +"edc55cccfccf255d", +"ef83841da441bebe", +"efb72c15809e51d2", +"f0ff1620402530e9", +"f1b9d950db7fc696", +"f22ac07b23bb6814", +"f234f409c17fdff2", +"f7bd18cf1ab93def", +"f8338c177adf6976", +"f8ead136e3fc6376", +"f94e25a1a0e0f37e", +"f9fa0db9d0691fd0", +"fe137ada2e6cd4b5", +"fe8920407cb5d09c" +], +"recover-the-original-array": [ +"0881b6cc13a61242", +"0a02526c5b35d123", +"0ea99e445ed53585", +"10261a05ddeb96fc", +"10261a05ddeb96fc", +"14a39c9897b93072", +"14a39c9897b93072", +"1d713540a6a31d25", +"267ae37783703e4e", +"3e345460ba112bb6", +"3ebcbec26ab80dde", +"4d4edb9804fa014d", +"4d6cf52368a71067", +"61383eedb1b48fbd", +"6d02a3ec3e67cc3e", +"6d02a3ec3e67cc3e", +"72d4f1c0d84739ed", +"778028853f56f742", +"7993017c20ffc113", +"7c51e6945acedd5b", +"8d4bdd92dd06edf7", +"93ca10930a6915c9", +"9d0a1f12cda81718", +"a7d3d65ed269c940", +"b6547044b052d062", +"bcb522b4830f603a", +"bf8206d67bce296c", +"bfe2cc672e040b06", +"bff7f59ab3188717", +"c34eacd72aec7397", +"e08ed0d5390d350c", +"e1d3ecd5651869a9", +"e335c200c84e8582", +"eec4c7c37dcd2c29", +"f7b006a1ab718b6f" +], +"rectangle-area": [], +"rectangle-area-ii": [], +"rectangle-overlap": [], +"redistribute-characters-to-make-all-strings-equal": [ +"e3173115a941aa75" +], +"reduce-array-size-to-the-half": [], +"reducing-dishes": [], +"reduction-operations-to-make-the-array-elements-equal": [], +"redundant-connection": [], +"redundant-connection-ii": [], +"reformat-date": [], +"reformat-phone-number": [], +"reformat-the-string": [], +"regions-cut-by-slashes": [ +"054fac2594aabec1", +"0b96a84b4e207fab", +"0d5d40e522cd742c", +"0ed7ac8567009b06", +"0ed7ac8567009b06", +"11e7b948edfced5a", +"13dbdb3266737b2d", +"13e1dba6d6b684ce", +"13e1dba6d6b684ce", +"1735732153c07668", +"18475bc94b3b8184", +"1abfac54b96b8f2b", +"1fb2c4b56c5ba4df", +"21c2d6ff185d0ea9", +"21c2d6ff185d0ea9", +"257e11155997b217", +"257e11155997b217", +"266be8110d2f46b1", +"26cb0c421ee01260", +"3bb2b0a1a680bcfb", +"4963d11272ce7daa", +"51ca4923ba4088ea", +"5a75a64c051b5a27", +"5b8db6183c2a544b", +"5d2a5da606881fa9", +"5fa0b33a1e1417a7", +"6451a8dc8f43812a", +"68d7909a6aedc1bd", +"6c03d51c506f8c87", +"731b8d56a0248d4e", +"731b8d56a0248d4e", +"78c300d00da271c7", +"78d72ed023e5112f", +"791ae61feb788992", +"7cc536dcc7c586a7", +"7f65fe69934aebf4", +"81ecc9450adb5b52", +"81ecc9450adb5b52", +"841ccd546d599245", +"86c5fea75898a689", +"876cdb19f2ac5543", +"8a57d90d4677ce82", +"8b5d15148f975154", +"8d17eaff471ae7ac", +"90b604aa1ef20b9f", +"964ff411f55a782d", +"96ddc8f6eb370f5a", +"96e9503efab3124d", +"993b307517da50f9", +"a23529d45826d922", +"a5a4511eb44c2385", +"a8afa1dcbeb157d9", +"aa2604ecdc9d642a", +"ab22698c22baca3d", +"b210b06373641d6f", +"be1d0e46af0d57bd", +"c1b7593aff27c034", +"c3b7e775e83b468e", +"c866ee48d1510293", +"c866ee48d1510293", +"c8f4f975a837cf5e", +"d0fd5c08455d78e1", +"d425fcb203850b61", +"d66a3b24864613b4", +"e4cea2e7f6bc6e42", +"e79158dc61d241ca", +"e7f91e2b6de2fa93", +"f8a4166cbdbad041", +"faf077c12e5b4eec" +], +"regular-expression-matching": [], +"relative-ranks": [], +"relative-sort-array": [ +"6949eaf09b40297a", +"c86a16ef8b925cd0" +], +"relocate-marbles": [], +"remove-9": [], +"remove-adjacent-almost-equal-characters": [], +"remove-all-adjacent-duplicates-in-string": [], +"remove-all-adjacent-duplicates-in-string-ii": [ +"69ba4b1fae637923" +], +"remove-all-occurrences-of-a-substring": [], +"remove-all-ones-with-row-and-column-flips": [], +"remove-all-ones-with-row-and-column-flips-ii": [ +"1bcb889ee836b14c", +"29cb00eecd3b3a54", +"356df3231b57445a", +"4a7f2c8d849fd4e2", +"520493d1ca840afb", +"5d2ab661316164d9", +"5d44975209257531", +"69497d27285fa4cf", +"71ff950cdf0775db", +"7778f6e6b72bf051", +"ccc291893bcae427", +"d322b3514f5f15c4", +"efad6b9c5e1412aa" +], +"remove-boxes": [], +"remove-colored-pieces-if-both-neighbors-are-the-same-color": [], +"remove-comments": [], +"remove-covered-intervals": [], +"remove-digit-from-number-to-maximize-result": [], +"remove-duplicate-letters": [], +"remove-duplicates-from-an-unsorted-linked-list": [], +"remove-duplicates-from-sorted-array": [], +"remove-duplicates-from-sorted-array-ii": [], +"remove-duplicates-from-sorted-list": [], +"remove-duplicates-from-sorted-list-ii": [], +"remove-element": [], +"remove-interval": [], +"remove-k-digits": [ +"90c7258162c40e5d", +"d67aa0163e9c339d" +], +"remove-letter-to-equalize-frequency": [], +"remove-linked-list-elements": [], +"remove-max-number-of-edges-to-keep-graph-fully-traversable": [], +"remove-methods-from-project": [], +"remove-nodes-from-linked-list": [], +"remove-nth-node-from-end-of-list": [], +"remove-one-element-to-make-the-array-strictly-increasing": [], +"remove-outermost-parentheses": [], +"remove-palindromic-subsequences": [], +"remove-stones-to-minimize-the-total": [], +"remove-sub-folders-from-the-filesystem": [], +"remove-trailing-zeros-from-a-string": [ +"2ee91ef7177b8723", +"a0ad9cdb53f9cb15" +], +"remove-vowels-from-a-string": [], +"remove-zero-sum-consecutive-nodes-from-linked-list": [], +"removing-minimum-and-maximum-from-array": [], +"removing-minimum-number-of-magic-beans": [], +"removing-stars-from-a-string": [], +"reorder-data-in-log-files": [], +"reorder-routes-to-make-all-paths-lead-to-the-city-zero": [], +"reordered-power-of-2": [], +"reorganize-string": [], +"repeated-dna-sequences": [], +"repeated-string-match": [], +"repeated-substring-pattern": [], +"replace-all-digits-with-characters": [], +"replace-all-s-to-avoid-consecutive-repeating-characters": [ +"195dbfb7be599415", +"72296eeb563a8786" +], +"replace-elements-in-an-array": [], +"replace-elements-with-greatest-element-on-right-side": [], +"replace-non-coprime-numbers-in-array": [], +"replace-question-marks-in-string-to-minimize-its-value": [], +"replace-the-substring-for-balanced-string": [], +"replace-words": [], +"report-spam-message": [], +"reschedule-meetings-for-maximum-free-time-i": [ +"2479e7645ee39b1f", +"bc8a9e549865f7ec", +"d38a739966d2da00", +"ef52c190fd908de7", +"f02fb640364564a2" +], +"reschedule-meetings-for-maximum-free-time-ii": [], +"reshape-the-matrix": [], +"restore-ip-addresses": [], +"restore-the-array": [], +"restore-the-array-from-adjacent-pairs": [ +"331cb5a8eefffdf0", +"3b84b224b64e88f3", +"a49ed61d6925a98c", +"a95d0ed97c2b7ab0" +], +"reveal-cards-in-increasing-order": [], +"reverse-bits": [], +"reverse-degree-of-a-string": [], +"reverse-integer": [], +"reverse-linked-list": [], +"reverse-linked-list-ii": [], +"reverse-nodes-in-even-length-groups": [], +"reverse-nodes-in-k-group": [], +"reverse-odd-levels-of-binary-tree": [], +"reverse-only-letters": [], +"reverse-pairs": [], +"reverse-prefix-of-word": [], +"reverse-string-ii": [], +"reverse-subarray-to-maximize-array-value": [], +"reverse-substrings-between-each-pair-of-parentheses": [], +"reverse-words-in-a-string": [], +"reverse-words-in-a-string-iii": [ +"2fdfa487299c7b3b", +"30e425809c35ee7e", +"41d18a38c9ff804d", +"63575b1971bae84d", +"9145c9e50e1da1ba", +"bdd6df43cb36b297", +"c595d97a80964d5b", +"c78fe269a344178d" +], +"reward-top-k-students": [], +"richest-customer-wealth": [], +"right-triangles": [], +"rings-and-rods": [], +"robot-bounded-in-circle": [], +"robot-collisions": [], +"robot-return-to-origin": [], +"roman-to-integer": [], +"root-equals-sum-of-children": [], +"rotate-function": [], +"rotate-list": [], +"rotate-string": [], +"rotated-digits": [], +"rotating-the-box": [], +"rotting-oranges": [], +"row-with-maximum-ones": [], +"running-sum-of-1d-array": [], +"russian-doll-envelopes": [], +"same-tree": [], +"satisfiability-of-equality-equations": [], +"score-after-flipping-matrix": [], +"score-of-a-string": [], +"score-of-parentheses": [], +"scramble-string": [], +"search-a-2d-matrix": [], +"search-a-2d-matrix-ii": [ +"140f2a9e718d8391" +], +"search-in-a-binary-search-tree": [], +"search-in-rotated-sorted-array": [], +"search-in-rotated-sorted-array-ii": [], +"search-insert-position": [], +"search-suggestions-system": [ +"229c37ea6fab6926" +], +"second-largest-digit-in-a-string": [], +"second-minimum-node-in-a-binary-tree": [], +"second-minimum-time-to-reach-destination": [], +"select-cells-in-grid-with-maximum-score": [ +"1ad55e46dddafdcb", +"ab74b42a5ad3e781", +"b231da32510a9e93", +"c3f24748a5a73f28" +], +"select-k-disjoint-special-substrings": [], +"self-crossing": [], +"self-dividing-numbers": [], +"sell-diminishing-valued-colored-balls": [], +"selling-pieces-of-wood": [ +"0ae3a0d1f180a97f", +"8ecfc64ea01a4237", +"f6b3019fd058a1be" +], +"semi-ordered-permutation": [], +"sender-with-largest-word-count": [], +"sentence-screen-fitting": [], +"sentence-similarity": [], +"sentence-similarity-ii": [], +"sentence-similarity-iii": [], +"separate-black-and-white-balls": [], +"separate-squares-i": [], +"separate-squares-ii": [], +"separate-the-digits-in-an-array": [], +"sequence-reconstruction": [], +"sequential-digits": [], +"set-intersection-size-at-least-two": [], +"set-mismatch": [], +"shift-2d-grid": [], +"shift-distance-between-two-strings": [ +"507eb29d302f8cea", +"63c617fb663d75c1", +"7477e6ebc1c67fb0", +"7d6065ff44bfb0df", +"b4a5d0689f63bd1f", +"faa2dee7a8de25aa" +], +"shifting-letters": [], +"shifting-letters-ii": [ +"6054de6c9e0b01ce" +], +"shopping-offers": [ +"5310ea5a1a5fcc1c", +"d98faefaf4dbb8e7", +"daac72e5496346eb", +"dde1c4e3240204b2" +], +"short-encoding-of-words": [], +"shortest-and-lexicographically-smallest-beautiful-string": [], +"shortest-bridge": [], +"shortest-common-supersequence": [], +"shortest-completing-word": [], +"shortest-cycle-in-a-graph": [], +"shortest-distance-after-road-addition-queries-i": [], +"shortest-distance-after-road-addition-queries-ii": [], +"shortest-distance-from-all-buildings": [], +"shortest-distance-to-a-character": [], +"shortest-distance-to-target-color": [], +"shortest-distance-to-target-string-in-a-circular-array": [], +"shortest-impossible-sequence-of-rolls": [], +"shortest-matching-substring": [ +"54c6bfbc24949cad", +"cbd14d4d4b2d4aa8" +], +"shortest-palindrome": [], +"shortest-path-in-a-grid-with-obstacles-elimination": [], +"shortest-path-in-binary-matrix": [], +"shortest-path-to-get-all-keys": [ +"4d9cba6bb284ec05", +"5030f0540ea539de", +"5d1e5b8a3bf35ea9" +], +"shortest-path-to-get-food": [], +"shortest-path-visiting-all-nodes": [], +"shortest-path-with-alternating-colors": [], +"shortest-string-that-contains-three-strings": [], +"shortest-subarray-to-be-removed-to-make-array-sorted": [], +"shortest-subarray-with-or-at-least-k-i": [], +"shortest-subarray-with-or-at-least-k-ii": [], +"shortest-subarray-with-sum-at-least-k": [], +"shortest-uncommon-substring-in-an-array": [], +"shortest-unsorted-continuous-subarray": [], +"shortest-way-to-form-string": [], +"shortest-word-distance": [], +"shortest-word-distance-iii": [], +"shuffle-string": [], +"shuffle-the-array": [ +"0f1062f08a07dd57", +"250ad836396d5baf", +"25e4e030843af3ed", +"422b837c82dccde6", +"62c3a2e4645bc2dd", +"77b304d61a63b923", +"8f7808ba9d9bcb25", +"e7cadf6d172625b5" +], +"sign-of-the-product-of-an-array": [], +"similar-rgb-color": [], +"similar-string-groups": [], +"simplified-fractions": [], +"simplify-path": [], +"single-element-in-a-sorted-array": [], +"single-number": [], +"single-number-ii": [ +"7e52b3c6539c43c0", +"a8d4e0074a74f340", +"ac0656baa38b7882", +"ea6ad312f623c8e1" +], +"single-number-iii": [], +"single-row-keyboard": [ +"38c5876702a407a8", +"421cd01427571834", +"48c69b9634032a81", +"51a518e8bea7267a", +"7e230c910d288f10", +"8bf298f46d206bd6", +"d9d0097f402fbaa0" +], +"single-threaded-cpu": [], +"sliding-puzzle": [], +"sliding-subarray-beauty": [], +"sliding-window-maximum": [], +"sliding-window-median": [], +"slowest-key": [ +"5110dcf8afb669fb", +"55f2968de96b9705", +"fecefff602543220" +], +"smallest-common-region": [], +"smallest-divisible-digit-product-i": [], +"smallest-divisible-digit-product-ii": [], +"smallest-even-multiple": [], +"smallest-good-base": [ +"20e0158f9c3ed183", +"2e9426b3f47c1297", +"432ed555937f82a4", +"7f4255bd828c55b4", +"b6ec1d21ee96c1cf", +"c08b3f85d65fb3bf", +"c382dee56bed9f1d", +"cdb3896be40787ac", +"d27484f79c172c35", +"d7ea17aa3dea19d7", +"f92e882187ece3ed", +"fb5f3ce990d20552" +], +"smallest-greater-multiple-made-of-two-digits": [], +"smallest-index-with-equal-value": [], +"smallest-integer-divisible-by-k": [ +"13d951eacb7a4bb7", +"6906685ea2879092" +], +"smallest-k-length-subsequence-with-occurrences-of-a-letter": [], +"smallest-missing-genetic-value-in-each-subtree": [ +"1857f17f31e55365", +"a87f73d898c8a443", +"e5147a8a0331267a" +], +"smallest-missing-integer-greater-than-sequential-prefix-sum": [ +"1a6171552ca01a94", +"ab3cd0fc07ace07f" +], +"smallest-missing-non-negative-integer-after-operations": [ +"c43657c61ce3262e", +"cb363460aca13e74", +"cb363460aca13e74", +"d572d040b48a19e3", +"e2915e571c3ff578", +"ef988b32c3135cc3" +], +"smallest-number-with-all-set-bits": [], +"smallest-number-with-given-digit-product": [], +"smallest-range-covering-elements-from-k-lists": [], +"smallest-range-i": [], +"smallest-range-ii": [], +"smallest-rectangle-enclosing-black-pixels": [], +"smallest-rotation-with-highest-score": [ +"79778b8329a78525", +"934b082015a31cf0", +"966100e371be0815", +"99fd2cbc8afff2f9", +"e5b4915cceb2cc7e" +], +"smallest-string-starting-from-leaf": [], +"smallest-string-with-a-given-numeric-value": [ +"1ed04aab62515327", +"458537e4b4c0c7fa", +"5aff7a09c2c90f4a", +"7a10ffd3037e5048" +], +"smallest-string-with-swaps": [], +"smallest-subarrays-with-maximum-bitwise-or": [], +"smallest-subsequence-of-distinct-characters": [ +"73d34cdcf5b042a7" +], +"smallest-substring-with-identical-characters-i": [], +"smallest-substring-with-identical-characters-ii": [], +"smallest-subtree-with-all-the-deepest-nodes": [], +"smallest-sufficient-team": [], +"smallest-value-after-replacing-with-sum-of-prime-factors": [], +"smallest-value-of-the-rearranged-number": [], +"snake-in-matrix": [], +"snakes-and-ladders": [], +"solve-the-equation": [ +"0e9c6ad8ffe770c4", +"2375c3e703b51648", +"5b129848cfcb187a", +"5d31bbe45fbe2456", +"6052f5b91592c24f", +"6a2ae69fcd82975c", +"88a0476b2edbfc73", +"988f402c08fd5667", +"c4d35b01bbf7a1c5", +"cab3cf0c81afbb9b", +"d1df8550efa22fca", +"e489e58ab0bf6cdd", +"eb943e9c290f9a72" +], +"solving-questions-with-brainpower": [], +"sort-an-array": [], +"sort-array-by-increasing-frequency": [], +"sort-array-by-moving-items-to-empty-space": [], +"sort-array-by-parity": [], +"sort-array-by-parity-ii": [ +"2d63bda93ef1d3c3", +"61a483e5a2300038", +"9f7c403b4030612b", +"e25b16dcc52372af", +"e7ca6159cacf5972", +"fca66b24c6a24596" +], +"sort-characters-by-frequency": [ +"78a21a4beaff847f" +], +"sort-even-and-odd-indices-independently": [], +"sort-features-by-popularity": [], +"sort-integers-by-the-number-of-1-bits": [ +"36e3a41ea3745ae1", +"a31f084a6762173a", +"bf2b7c01cdc65691", +"ca9446d84ad0098b", +"d066c9d1784be654", +"d3ee483bb2edea94" +], +"sort-integers-by-the-power-value": [], +"sort-items-by-groups-respecting-dependencies": [], +"sort-linked-list-already-sorted-using-absolute-values": [], +"sort-list": [], +"sort-matrix-by-diagonals": [], +"sort-the-jumbled-numbers": [], +"sort-the-matrix-diagonally": [], +"sort-the-people": [], +"sort-the-students-by-their-kth-score": [], +"sort-transformed-array": [], +"sort-vowels-in-a-string": [], +"sorted-gcd-pair-queries": [], +"sorting-the-sentence": [ +"119b2c9f765cdd6c", +"28abe2e640b952cd", +"6cca0e14decc516a", +"b1fd0b5c856f8d27", +"be7a834467d7b558" +], +"sorting-three-groups": [], +"soup-servings": [], +"sparse-matrix-multiplication": [], +"special-array-i": [], +"special-array-ii": [], +"special-array-with-x-elements-greater-than-or-equal-x": [], +"special-binary-string": [], +"special-permutations": [], +"special-positions-in-a-binary-matrix": [], +"spiral-matrix": [], +"spiral-matrix-ii": [], +"spiral-matrix-iii": [], +"spiral-matrix-iv": [], +"split-a-string-in-balanced-strings": [], +"split-a-string-into-the-max-number-of-unique-substrings": [], +"split-array-into-consecutive-subsequences": [], +"split-array-into-fibonacci-sequence": [], +"split-array-into-maximum-number-of-subarrays": [], +"split-array-largest-sum": [], +"split-array-with-equal-sum": [], +"split-array-with-same-average": [], +"split-concatenated-strings": [], +"split-message-based-on-limit": [], +"split-strings-by-separator": [], +"split-the-array": [ +"55828a3ebad8a363" +], +"split-the-array-to-make-coprime-products": [], +"split-two-strings-to-make-palindrome": [ +"3a7f210eb424616b" +], +"split-with-minimum-sum": [], +"splitting-a-string-into-descending-consecutive-values": [], +"sqrtx": [], +"squares-of-a-sorted-array": [], +"squirrel-simulation": [], +"stamping-the-grid": [], +"stamping-the-sequence": [], +"statistics-from-a-large-sample": [], +"step-by-step-directions-from-a-binary-tree-node-to-another": [], +"stepping-numbers": [], +"steps-to-make-array-non-decreasing": [], +"stickers-to-spell-word": [ +"0721f857014de8c8", +"22796074396feeca", +"440abcd14a01cecc", +"9f13719afd773e3e", +"f857a3f5cdaf3e72" +], +"stone-game": [], +"stone-game-ii": [], +"stone-game-iii": [], +"stone-game-iv": [], +"stone-game-ix": [], +"stone-game-v": [], +"stone-game-vi": [], +"stone-game-vii": [], +"stone-game-viii": [], +"stone-removal-game": [], +"strange-printer": [], +"strange-printer-ii": [], +"strictly-palindromic-number": [], +"string-compression": [], +"string-compression-ii": [], +"string-compression-iii": [], +"string-matching-in-an-array": [], +"string-to-integer-atoi": [], +"string-transformation": [], +"string-transforms-into-another-string": [ +"2abecc3a5935ef8d", +"5883ca6aea4397bb", +"5b7a3b6f6e054437", +"fbf00096f737eaa7" +], +"string-without-aaa-or-bbb": [ +"042a77403abdc88e", +"0783e52b7fdcb5f0", +"0af9c5036c20a1c5", +"14a763ac7fa00d80", +"1b538c00f1e2bfbe", +"1cc643361f4e73f8", +"1f8612151fcec727", +"271c68638804dd19", +"2c2d26b67dbac025", +"327d3cc1b3d10dd9", +"36811bda0b865a27", +"4049f806972a4379", +"45fb18e35fe1efcb", +"5c0ac7f621127a8b", +"5cba680468b2a8ed", +"6837a7acc3548a8d", +"89279faeeb22e7a6", +"95b26e6e74570b40", +"9c2316bdb808d70e", +"9c4c2a6289800bf6", +"9dd378b7adc6e6fb", +"a5aa729b93c993a8", +"a6905666300be98b", +"bea90f7406a1139e", +"c07717ffc0559e5f", +"c2aadf69dea64beb", +"dfa05ac59d24ce13", +"e928ea130d485bcf", +"f472982e3e1fe879" +], +"strings-differ-by-one-character": [], +"strobogrammatic-number": [], +"strobogrammatic-number-ii": [], +"strobogrammatic-number-iii": [], +"strong-password-checker": [], +"strong-password-checker-ii": [], +"student-attendance-record-i": [], +"student-attendance-record-ii": [], +"subarray-product-less-than-k": [ +"29273957ac59ce32", +"c0bc2438c04edb49", +"f07d7f68ac1a8d41" +], +"subarray-sum-equals-k": [], +"subarray-sums-divisible-by-k": [], +"subarray-with-elements-greater-than-varying-threshold": [], +"subarrays-distinct-element-sum-of-squares-i": [], +"subarrays-distinct-element-sum-of-squares-ii": [], +"subarrays-with-k-different-integers": [ +"327d4cde4642aedc", +"5fc756e4d5e5aabf", +"738a112ff2df61b8", +"ac9780eb5e9b2467", +"ad8c9e7d8a138c62", +"c5680d3e71167ff3" +], +"subdomain-visit-count": [], +"subsequence-of-size-k-with-the-largest-even-sum": [], +"subsequence-with-the-minimum-score": [], +"subsequences-with-a-unique-middle-mode-i": [], +"subsequences-with-a-unique-middle-mode-ii": [], +"subsets": [], +"subsets-ii": [], +"substring-matching-pattern": [], +"substring-with-concatenation-of-all-words": [], +"substring-with-largest-variance": [], +"substring-xor-queries": [], +"substrings-of-size-three-with-distinct-characters": [], +"substrings-that-begin-and-end-with-the-same-letter": [], +"subtract-the-product-and-sum-of-digits-of-an-integer": [], +"subtree-of-another-tree": [], +"subtree-removal-game-with-fibonacci-tree": [], +"successful-pairs-of-spells-and-potions": [], +"sum-game": [], +"sum-in-a-matrix": [ +"62b43484f3ec573a" +], +"sum-multiples": [], +"sum-of-absolute-differences-in-a-sorted-array": [], +"sum-of-all-odd-length-subarrays": [], +"sum-of-all-subset-xor-totals": [], +"sum-of-beauty-in-the-array": [], +"sum-of-beauty-of-all-substrings": [], +"sum-of-consecutive-subarrays": [], +"sum-of-consecutive-subsequences": [], +"sum-of-digit-differences-of-all-pairs": [], +"sum-of-digits-in-base-k": [], +"sum-of-digits-in-the-minimum-number": [], +"sum-of-digits-of-string-after-convert": [], +"sum-of-distances": [], +"sum-of-distances-in-tree": [], +"sum-of-even-numbers-after-queries": [], +"sum-of-floored-pairs": [], +"sum-of-good-numbers": [], +"sum-of-good-subsequences": [ +"80da361819220d92", +"9684d3356eda55f9" +], +"sum-of-imbalance-numbers-of-all-subarrays": [], +"sum-of-k-mirror-numbers": [], +"sum-of-k-subarrays-with-length-at-least-m": [], +"sum-of-left-leaves": [], +"sum-of-matrix-after-queries": [], +"sum-of-mutated-array-closest-to-target": [], +"sum-of-nodes-with-even-valued-grandparent": [], +"sum-of-number-and-its-reverse": [], +"sum-of-numbers-with-units-digit-k": [], +"sum-of-prefix-scores-of-strings": [], +"sum-of-remoteness-of-all-cells": [ +"07b0fca396ba8074" +], +"sum-of-root-to-leaf-binary-numbers": [], +"sum-of-scores-of-built-strings": [], +"sum-of-special-evenly-spaced-elements-in-array": [], +"sum-of-square-numbers": [], +"sum-of-squares-of-special-elements": [], +"sum-of-subarray-minimums": [], +"sum-of-subarray-ranges": [], +"sum-of-subsequence-widths": [], +"sum-of-total-strength-of-wizards": [], +"sum-of-two-integers": [], +"sum-of-unique-elements": [ +"229d3637f75c0340" +], +"sum-of-values-at-indices-with-k-set-bits": [], +"sum-of-variable-length-subarrays": [], +"sum-root-to-leaf-numbers": [], +"summary-ranges": [], +"super-egg-drop": [], +"super-palindromes": [ +"0950378e9c45d075", +"102a0cb352a7ed76", +"15e3e1929ae0e1b3", +"4bd38d5f9cabe435", +"55da4761e87efbab", +"6670363b055c93ae", +"82f232d094b62305", +"fbba87718081496a" +], +"super-ugly-number": [], +"super-washing-machines": [], +"surface-area-of-3d-shapes": [ +"2579dbca405f4abd", +"a3515fe5386fa0c4", +"de4fc5c757774651" +], +"swap-adjacent-in-lr-string": [], +"swap-for-longest-repeated-character-substring": [], +"swap-nodes-in-pairs": [], +"swapping-nodes-in-a-linked-list": [], +"swim-in-rising-water": [ +"414b449c929b34c6", +"808aaaef11a28c2f" +], +"symmetric-tree": [], +"synonymous-sentences": [], +"tag-validator": [], +"take-gifts-from-the-richest-pile": [], +"take-k-of-each-character-from-left-and-right": [ +"0066a661ee812394", +"0c65ba7f572473a7", +"90de42424e7e9399" +], +"taking-maximum-energy-from-the-mystic-dungeon": [], +"tallest-billboard": [ +"d9531eeab4e6acb6" +], +"target-sum": [], +"task-scheduler": [], +"task-scheduler-ii": [], +"teemo-attacking": [], +"ternary-expression-parser": [], +"text-justification": [ +"4b3a18588be60e48", +"6c8ac24e6a3c9510", +"96a5ac74cf9c3add", +"ae3408cf1496962a", +"d3f474d61d2b2ce2", +"e427bc52130be0bc" +], +"the-earliest-and-latest-rounds-where-players-compete": [], +"the-earliest-moment-when-everyone-become-friends": [], +"the-employee-that-worked-on-the-longest-task": [], +"the-k-strongest-values-in-an-array": [], +"the-k-th-lexicographical-string-of-all-happy-strings-of-length-n": [], +"the-k-weakest-rows-in-a-matrix": [ +"6c40f14adc4d9e04" +], +"the-knights-tour": [], +"the-kth-factor-of-n": [], +"the-latest-time-to-catch-a-bus": [], +"the-maze": [], +"the-maze-ii": [], +"the-maze-iii": [ +"4a4d2d482b830d59" +], +"the-most-similar-path-in-a-graph": [], +"the-number-of-beautiful-subsets": [ +"0c244a204d2767b2", +"0c244a204d2767b2", +"18ae07e2c5a25180", +"6288375b2234a5fe", +"b3aa20949d4e873e", +"c53478d8969d86f4", +"e8c4b7bb62eb15b5", +"f98923250544383f" +], +"the-number-of-full-rounds-you-have-played": [], +"the-number-of-good-subsets": [], +"the-number-of-the-smallest-unoccupied-chair": [], +"the-number-of-ways-to-make-the-sum": [], +"the-number-of-weak-characters-in-the-game": [], +"the-score-of-students-solving-math-expression": [ +"3d0418fec5de94e0", +"3e860cc46f179d6d", +"ebc69c1d2d287268" +], +"the-skyline-problem": [ +"338bddb43de119d5", +"b6540cb7f713e721" +], +"the-time-when-the-network-becomes-idle": [], +"the-two-sneaky-numbers-of-digitville": [ +"0039cd28914b9b4c", +"31151442dd489809", +"4e451e144bf671c4", +"73a269f6971a6935", +"973b82e96504d67b", +"c1736272eecc84d7" +], +"the-wording-game": [], +"third-maximum-number": [], +"thousand-separator": [], +"three-consecutive-odds": [], +"three-divisors": [], +"three-equal-parts": [], +"tiling-a-rectangle-with-the-fewest-squares": [ +"cc01b7c4d5b49822" +], +"time-needed-to-buy-tickets": [], +"time-needed-to-inform-all-employees": [], +"time-needed-to-rearrange-a-binary-string": [], +"time-taken-to-cross-the-door": [], +"time-taken-to-mark-all-nodes": [], +"time-to-cross-a-bridge": [], +"to-lower-case": [], +"toeplitz-matrix": [], +"top-k-frequent-elements": [ +"045e53f3052ebc98", +"141c696b3adc1a31", +"334b4da5f8008f76", +"41c6319590b72568", +"55a8b9d9be84953c", +"66a8df66b177b35f", +"7dce357e3665c48e", +"8fa6358caf9519e4", +"971bb86a40b652c4", +"a5611de835a32ec5", +"f34d9e865fb49ffd" +], +"top-k-frequent-words": [ +"f31e8fd04d0513b6" +], +"toss-strange-coins": [], +"total-appeal-of-a-string": [], +"total-characters-in-string-after-transformations-i": [], +"total-characters-in-string-after-transformations-ii": [ +"233e46b4a544281c", +"7308587f6337c9ef", +"9267e82951c2c29d", +"c046f0a1b6671d10", +"fe3b171dd02d105e" +], +"total-cost-to-hire-k-workers": [], +"total-distance-traveled": [], +"total-hamming-distance": [], +"transform-array-by-parity": [], +"transform-to-chessboard": [], +"transformed-array": [], +"trapping-rain-water": [], +"trapping-rain-water-ii": [], +"tree-diameter": [], +"tree-of-coprimes": [ +"09cf6dd3364c4ac2", +"38359dfbd5585c5d", +"3d7a7f42eb303190", +"568f9f3a1969c910", +"74432cbb63f8da94", +"82135de05d7138b9", +"a40589e8cfb3e1dd", +"d64d669d329e07d2" +], +"triangle": [], +"trim-a-binary-search-tree": [], +"triples-with-bitwise-and-equal-to-zero": [], +"truncate-sentence": [ +"45243c866b9825f7", +"5f64474f56c1109c" +], +"tuple-with-same-product": [ +"1221c3e79370480b", +"22d162feffb65b62", +"5b2aab527d591d63" +], +"two-best-non-overlapping-events": [], +"two-city-scheduling": [], +"two-furthest-houses-with-different-colors": [ +"90b6cb52d7fa6f51" +], +"two-out-of-three": [ +"1ed018b4ed19d454", +"394f9b3fd60fcb07", +"50c18e384cb2298b", +"d735cef65c1c7bc0" +], +"two-sum": [], +"two-sum-bsts": [], +"two-sum-ii-input-array-is-sorted": [], +"two-sum-iv-input-is-a-bst": [], +"two-sum-less-than-k": [], +"type-of-triangle": [], +"ugly-number": [], +"ugly-number-ii": [], +"ugly-number-iii": [], +"uncommon-words-from-two-sentences": [ +"26c9a535dd2a4cfd", +"388946f1479b00d7", +"ae076a53997f7546", +"c64629b2a0f476aa", +"ca7704d3bb7de98e", +"d8ecaa77f8d4747b" +], +"uncrossed-lines": [], +"unique-3-digit-even-numbers": [], +"unique-binary-search-trees": [], +"unique-email-addresses": [], +"unique-length-3-palindromic-subsequences": [], +"unique-morse-code-words": [], +"unique-number-of-occurrences": [], +"unique-paths": [], +"unique-paths-ii": [], +"unique-paths-iii": [], +"unique-substrings-in-wraparound-string": [], +"unique-substrings-with-equal-digit-frequency": [], +"univalued-binary-tree": [], +"using-a-robot-to-print-the-lexicographically-smallest-string": [], +"utf-8-validation": [], +"valid-anagram": [], +"valid-arrangement-of-pairs": [ +"22ad5f2d8a9f5498", +"252228a848e42940", +"60a5ec152013e4ce", +"63a749cd3902b46b", +"7dd31a916d40a442", +"7dd31a916d40a442", +"807c2615c62866f5", +"88f644eb2cebb951", +"b57cff92a7be7920", +"bf68a4e14299a493", +"c2cf34ce098ec105", +"eb442e970ce0b92e" +], +"valid-boomerang": [], +"valid-mountain-array": [], +"valid-number": [], +"valid-palindrome-ii": [], +"valid-palindrome-iii": [], +"valid-palindrome-iv": [], +"valid-parentheses": [], +"valid-parenthesis-string": [], +"valid-perfect-square": [], +"valid-permutations-for-di-sequence": [], +"valid-square": [], +"valid-sudoku": [], +"valid-tic-tac-toe-state": [], +"valid-triangle-number": [], +"valid-word": [], +"valid-word-abbreviation": [], +"valid-word-square": [], +"validate-binary-search-tree": [], +"validate-binary-tree-nodes": [], +"validate-ip-address": [], +"validate-stack-sequences": [], +"verbal-arithmetic-puzzle": [], +"verify-preorder-sequence-in-binary-search-tree": [], +"verify-preorder-serialization-of-a-binary-tree": [], +"verifying-an-alien-dictionary": [ +"3ce6e99bf3f83090", +"63c7a7a504c252b0", +"6574a41a9623530d", +"b56b2fcc822e6d85", +"dd023f2b62cac8c3", +"dd023f2b62cac8c3", +"e648538f434bc9a4" +], +"vertical-order-traversal-of-a-binary-tree": [], +"video-stitching": [], +"visit-array-positions-to-maximize-score": [], +"vowel-spellchecker": [], +"vowels-game-in-a-string": [], +"vowels-of-all-substrings": [], +"walking-robot-simulation": [ +"dcd39110d619f441" +], +"water-and-jug-problem": [], +"water-bottles": [], +"water-bottles-ii": [], +"watering-plants": [], +"watering-plants-ii": [], +"ways-to-express-an-integer-as-sum-of-powers": [], +"ways-to-make-a-fair-array": [], +"ways-to-split-array-into-good-subarrays": [], +"ways-to-split-array-into-three-subarrays": [], +"web-crawler-multithreaded": [], +"where-will-the-ball-fall": [], +"widest-pair-of-indices-with-equal-range-sum": [ +"28f38872433ecfa6", +"96c10d4dbcfd7396", +"9b2f47d1510bdc8f", +"b1b8506cf488f088", +"bb2ced683f4f4c8b", +"d803e572ccdeb8c8" +], +"widest-vertical-area-between-two-points-containing-no-points": [], +"wiggle-subsequence": [], +"wildcard-matching": [], +"winner-of-the-linked-list-game": [], +"word-abbreviation": [], +"word-break": [], +"word-break-ii": [], +"word-ladder": [], +"word-pattern": [], +"word-pattern-ii": [], +"word-search": [], +"word-search-ii": [], +"word-squares": [], +"word-subsets": [ +"366524913d63cdb4" +], +"words-within-two-edits-of-dictionary": [ +"0bdc514a846bd7a9", +"22647f9a6a0112b9", +"232a94557543168f", +"6582a53ae6b1c91b", +"a8e8f1851f206d0d", +"f2b5fa4a8eca789b" +], +"x-of-a-kind-in-a-deck-of-cards": [], +"xor-operation-in-an-array": [], +"xor-queries-of-a-subarray": [], +"zero-array-transformation-i": [], +"zero-array-transformation-ii": [], +"zero-array-transformation-iii": [], +"zero-array-transformation-iv": [], +"zigzag-conversion": [], +"zigzag-grid-traversal-with-skip": [] } \ No newline at end of file diff --git a/backend/localcode/importer/build.py b/backend/localcode/importer/build.py index 88ba76f..f732821 100644 --- a/backend/localcode/importer/build.py +++ b/backend/localcode/importer/build.py @@ -16,6 +16,7 @@ from localcode.importer.doocs import DoocsProblem, iter_problem_dirs, parse_problem_dir from localcode.importer.local import LocalProblem, load_local from localcode.importer.signatures import cpp_starter, java_starter, kotlin_starter, parse_cpp_sig, parse_java_sig +from localcode.judging.answer_modes import answer_mode Progress = Callable[[str, int, int], None] EXCLUDED_CASES = Path(__file__).resolve().parent.parent / "data" / "excluded_cases.json" @@ -91,6 +92,7 @@ def _problem_rows( else: ref_python = method = params = ret = None compare_mode = "exact" + compare_mode = answer_mode(slug, compare_mode) if local and local.compare_mode: compare_mode = local.compare_mode nparams = len(params) if params is not None else None diff --git a/backend/localcode/importer/local.py b/backend/localcode/importer/local.py index 19c3548..3a9e84f 100644 --- a/backend/localcode/importer/local.py +++ b/backend/localcode/importer/local.py @@ -14,7 +14,7 @@ SLUG_RE = re.compile(r"^[a-z0-9]+(-[a-z0-9]+)*$") DIFFICULTIES = ("Easy", "Medium", "Hard") -COMPARE_MODES = ("exact", "any_order") +COMPARE_MODES = ("exact", "any_order", "any_order_deep", "each_any_order") LANG_TAGS = {"python": "python", "python3": "python", "java": "java", "cpp": "cpp", "c++": "cpp", "kotlin": "kotlin"} PROBLEM_KEYS = {"title", "difficulty", "tags", "id", "compare"} SOLUTION_KEYS = {"title"} diff --git a/backend/localcode/judging/answer_modes.py b/backend/localcode/judging/answer_modes.py new file mode 100644 index 0000000..368dbdc --- /dev/null +++ b/backend/localcode/judging/answer_modes.py @@ -0,0 +1,48 @@ +"""How each problem's answers are compared, beyond what the statement's wording reveals. + +The importer starts from `exact`, or `any_order` when the statement says "in any order", and then +applies this module: a registered checker wins, then the curated modes below. +""" + +from localcode.judging.checkers import CHECKERS +from localcode.judging.compare import CHECKER_PREFIX + +# Problems whose answers are collections of sets: order is free at every level. +_ANY_ORDER_DEEP = ( + "4sum", + "combination-sum", + "combination-sum-iii", + "combinations", + "critical-connections-in-a-network", + "factor-combinations", + "find-duplicate-file-in-system", + "group-anagrams", + "group-shifted-strings", + "subsets", + "subsets-ii", +) +# Problems whose answer has fixed slots, each an unordered list. +_EACH_ANY_ORDER = ( + "find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree", + "find-the-difference-of-two-arrays", +) + +# Problems whose answers may be in any order although the statement doesn't say "in any order" +# (found by validate_cases' order report). +_ANY_ORDER = ( + "concatenated-words", + "high-access-employees", +) + +MODES: dict[str, str] = { + **dict.fromkeys(_ANY_ORDER, "any_order"), + **dict.fromkeys(_ANY_ORDER_DEEP, "any_order_deep"), + **dict.fromkeys(_EACH_ANY_ORDER, "each_any_order"), +} + + +def answer_mode(slug: str, default: str) -> str: + """The compare mode for `slug`, given the one inferred from its statement.""" + if slug in CHECKERS: + return f"{CHECKER_PREFIX}{slug}" + return MODES.get(slug, default) diff --git a/backend/localcode/judging/checkers/__init__.py b/backend/localcode/judging/checkers/__init__.py new file mode 100644 index 0000000..568b635 --- /dev/null +++ b/backend/localcode/judging/checkers/__init__.py @@ -0,0 +1,30 @@ +"""Per-problem answer checkers for problems that accept more than one correct answer. + +A checker decides whether `actual` is a valid answer for the inputs `args`, given the reference +answer `expected` (useful for comparing an optimum, such as a minimum length). Problems with a +checker are imported with `compare_mode = "checker:"`. Checkers run on untrusted output, so +any exception counts as a rejection (see `localcode.judging.compare.judge`). +""" + +from collections.abc import Callable +from typing import Any + +Checker = Callable[[list[Any], Any, Any], bool] +CHECKERS: dict[str, Checker] = {} + + +def checker(*slugs: str) -> Callable[[Checker], Checker]: + """Register a checker for one or more problem slugs.""" + + def register(fn: Checker) -> Checker: + for slug in slugs: + if slug in CHECKERS: + raise ValueError(f"duplicate checker for {slug}") + CHECKERS[slug] = fn + return fn + + return register + + +# Registers every checker (the modules import `checker` from this package). +from localcode.judging.checkers import arrays, encodings, graphs, grids, numbers, strings # noqa: E402, F401 diff --git a/backend/localcode/judging/checkers/arrays.py b/backend/localcode/judging/checkers/arrays.py new file mode 100644 index 0000000..b343471 --- /dev/null +++ b/backend/localcode/judging/checkers/arrays.py @@ -0,0 +1,200 @@ +"""Answer checkers: arrays.""" + +from collections import Counter, deque +from itertools import pairwise +from typing import Any + +from localcode.judging.checkers import checker + + +def _is_int(x: Any) -> bool: + return isinstance(x, int) and not isinstance(x, bool) + + +def _int_list(x: Any, n: int | None = None) -> bool: + return isinstance(x, list) and (n is None or len(x) == n) and all(_is_int(v) for v in x) + + +def _permutation_of(actual: Any, source: list[int]) -> bool: + return _int_list(actual, len(source)) and Counter(actual) == Counter(source) + + +def _advantage(a: list[int], b: list[int]) -> int: + return sum(x > y for x, y in zip(a, b, strict=True)) + + +@checker("advantage-shuffle") +def advantage_shuffle(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of nums1 whose advantage over nums2 equals the optimal advantage.""" + nums1, nums2 = args + return _permutation_of(actual, nums1) and _advantage(actual, nums2) == _advantage(expected, nums2) + + +@checker("array-with-elements-not-equal-to-average-of-neighbors") +def not_average_of_neighbors(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of nums where no inner element is the average of its two neighbors.""" + return _permutation_of(actual, args[0]) and all( + 2 * actual[i] != actual[i - 1] + actual[i + 1] for i in range(1, len(actual) - 1) + ) + + +@checker("distant-barcodes") +def distant_barcodes(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of barcodes with no two adjacent values equal.""" + return _permutation_of(actual, args[0]) and all(a != b for a, b in pairwise(actual)) + + +@checker("find-anagram-mappings") +def anagram_mappings(args: list[Any], expected: Any, actual: Any) -> bool: + """mapping[i] is an index of nums2 holding nums1[i].""" + nums1, nums2 = args + n = len(nums2) + return _int_list(actual, len(nums1)) and all( + 0 <= j < n and nums2[j] == v for v, j in zip(nums1, actual, strict=True) + ) + + +@checker("find-indices-with-index-and-value-difference-i", "find-indices-with-index-and-value-difference-ii") +def indices_with_differences(args: list[Any], expected: Any, actual: Any) -> bool: + """[i, j] with |i - j| >= indexDifference and |nums[i] - nums[j]| >= valueDifference, else [-1, -1].""" + nums, index_diff, value_diff = args + if not _int_list(actual, 2): + return False + if expected == [-1, -1]: + return actual == [-1, -1] + i, j = actual + n = len(nums) + return 0 <= i < n and 0 <= j < n and abs(i - j) >= index_diff and abs(nums[i] - nums[j]) >= value_diff + + +@checker("find-subsequence-of-length-k-with-the-largest-sum") +def largest_sum_subsequence(args: list[Any], expected: Any, actual: Any) -> bool: + """A length-k subsequence of nums whose sum equals the largest possible sum.""" + nums, k = args + if not _int_list(actual, k) or sum(actual) != sum(expected): + return False + it = iter(nums) + return all(any(v == x for x in it) for v in actual) + + +@checker("sort-array-by-parity") +def sort_by_parity(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of nums with every even value before every odd value.""" + if not _permutation_of(actual, args[0]): + return False + evens = sum(v % 2 == 0 for v in actual) + return all(v % 2 == 0 for v in actual[:evens]) + + +@checker("sort-array-by-parity-ii") +def sort_by_parity_ii(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of nums where each value's parity matches its index's parity.""" + return _permutation_of(actual, args[0]) and all(v % 2 == i % 2 for i, v in enumerate(actual)) + + +@checker("neither-minimum-nor-maximum") +def neither_min_nor_max(args: list[Any], expected: Any, actual: Any) -> bool: + """A value of nums that is neither its minimum nor its maximum, else -1.""" + nums = args[0] + if not _is_int(actual): + return False + if expected == -1: + return actual == -1 + return actual in nums and min(nums) < actual < max(nums) + + +@checker("subarray-with-elements-greater-than-varying-threshold") +def varying_threshold_subarray(args: list[Any], expected: Any, actual: Any) -> bool: + """A length k such that some length-k subarray has every element > threshold / k, else -1.""" + nums, threshold = args + if not _is_int(actual): + return False + if expected == -1: + return actual == -1 + k = actual + if not 1 <= k <= len(nums): + return False + window: deque[int] = deque() + for i, v in enumerate(nums): + while window and nums[window[-1]] >= v: + window.pop() + window.append(i) + if window[0] <= i - k: + window.popleft() + if i >= k - 1 and nums[window[0]] * k > threshold: + return True + return False + + +def _binary_digits(bits: list[int]) -> list[int]: + for start, b in enumerate(bits): + if b: + return bits[start:] + return [] + + +@checker("three-equal-parts") +def three_equal_parts(args: list[Any], expected: Any, actual: Any) -> bool: + """[i, j] splitting arr into three non-empty parts with equal binary values, else [-1, -1].""" + arr = args[0] + if not _int_list(actual, 2): + return False + if expected == [-1, -1]: + return actual == [-1, -1] + i, j = actual + if not (i >= 0 and i + 1 < j < len(arr)): + return False + first = _binary_digits(arr[: i + 1]) + return first == _binary_digits(arr[i + 1 : j]) == _binary_digits(arr[j:]) + + +def _split_depth(seq: str, split: Any) -> int: + if not isinstance(split, list) or len(split) != len(seq): + raise ValueError("split length must match seq") + depth = [0, 0] + best = 0 + for ch, side in zip(seq, split, strict=True): + if not _is_int(side) or side not in (0, 1): + raise ValueError("split values must be 0 or 1") + if ch == "(": + depth[side] += 1 + best = max(best, depth[side]) + else: + depth[side] -= 1 + if depth[side] < 0: + raise ValueError("subsequence is not a valid parentheses string") + if depth != [0, 0]: + raise ValueError("subsequence is not a valid parentheses string") + return best + + +@checker("maximum-nesting-depth-of-two-valid-parentheses-strings") +def two_vps_split(args: list[Any], expected: Any, actual: Any) -> bool: + """A 0/1 split of seq into two VPS whose larger nesting depth equals the minimum possible.""" + seq = args[0] + return _split_depth(seq, actual) == _split_depth(seq, expected) + + +@checker("fair-candy-swap") +def fair_candy_swap(args: list[Any], expected: Any, actual: Any) -> bool: + """[a, b] with a in aliceSizes, b in bobSizes, and equal totals after swapping them.""" + alice, bob = args + if not _int_list(actual, 2): + return False + a, b = actual + return a in set(alice) and b in set(bob) and sum(alice) - a + b == sum(bob) - b + a + + +@checker("find-k-pairs-with-smallest-sums") +def k_smallest_pairs(args: list[Any], expected: Any, actual: Any) -> bool: + """Distinct (nums1, nums2) index pairs, in any order, whose sums are the k smallest.""" + nums1, nums2, _ = args + if not isinstance(actual, list) or len(actual) != len(expected): + return False + if not all(_int_list(pair, 2) for pair in actual): + return False + count1, count2 = Counter(nums1), Counter(nums2) + pairs = Counter((u, v) for u, v in actual) + if any(n > count1[u] * count2[v] for (u, v), n in pairs.items()): + return False + return sorted(u + v for u, v in actual) == sorted(u + v for u, v in expected) diff --git a/backend/localcode/judging/checkers/encodings.py b/backend/localcode/judging/checkers/encodings.py new file mode 100644 index 0000000..db7eaa6 --- /dev/null +++ b/backend/localcode/judging/checkers/encodings.py @@ -0,0 +1,261 @@ +"""Answer checkers: encodings.""" + +import re +from itertools import pairwise +from typing import Any + +from localcode.judging.checkers import checker + +_MOVES = {"U": (-1, 0), "D": (1, 0), "L": (0, -1), "R": (0, 1)} +_DECIMAL = re.compile(r"(-?)(0|[1-9][0-9]*)(?:\.([0-9]*)(?:\(([0-9]+)\))?)?") +_EXPRESSION = re.compile(r"([0-9]*)\(([0-9]+)\+([0-9]+)\)([0-9]*)") +_CIDR = re.compile(r"([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/([0-9]{1,2})") + + +def _is_subsequence(sub: str, s: str) -> bool: + it = iter(s) + return all(c in it for c in sub) + + +def _no_leading_zero(digits: str) -> bool: + return digits == "0" or not digits.startswith("0") + + +@checker("alien-dictionary") +def alien_dictionary(args: list[Any], expected: Any, actual: Any) -> bool: + """Each present letter exactly once, ordered consistently with every adjacent word pair ("" if none exists).""" + if expected == "": + return actual == "" + words = args[0] + if not isinstance(actual, str) or len(set(actual)) != len(actual) or set(actual) != set("".join(words)): + return False + rank = {c: i for i, c in enumerate(actual)} + for w1, w2 in pairwise(words): + diff = next(((a, b) for a, b in zip(w1, w2, strict=False) if a != b), None) + if diff is None: + if len(w1) > len(w2): + return False + elif rank[diff[0]] > rank[diff[1]]: + return False + return True + + +@checker("alphabet-board-path") +def alphabet_board_path(args: list[Any], expected: Any, actual: Any) -> bool: + """Moves that stay on the board, spell target, and are as few as the optimum.""" + if not isinstance(actual, str) or len(actual) != len(expected): + return False + r = c = 0 + spelled = [] + for move in actual: + if move == "!": + spelled.append(chr(ord("a") + 5 * r + c)) + continue + dr, dc = _MOVES[move] + r, c = r + dr, c + dc + if not ((0 <= r < 5 and 0 <= c < 5) or (r, c) == (5, 0)): + return False + return "".join(spelled) == args[0] + + +def _decode(enc: str, i: int, limit: int) -> tuple[str, int]: + """Decode `enc` from index `i` up to a closing bracket or the end; returns (text, next index).""" + out: list[str] = [] + size = 0 + while i < len(enc) and enc[i] != "]": + if enc[i].isascii() and enc[i].islower(): + part, i = enc[i], i + 1 + else: + start = i + while i < len(enc) and enc[i].isascii() and enc[i].isdigit(): + i += 1 + digits = enc[start:i] + if not digits or digits[0] == "0" or i >= len(enc) or enc[i] != "[": + raise ValueError("malformed encoding") + inner, i = _decode(enc, i + 1, limit) + if i >= len(enc) or not inner: + raise ValueError("malformed encoding") + i += 1 + if len(inner) * int(digits) > limit: + raise ValueError("decodes past the input") + part = inner * int(digits) + if i - start >= len(part): + raise ValueError("encoding does not shorten its text") + size += len(part) + if size > limit: + raise ValueError("decodes past the input") + out.append(part) + return "".join(out), i + + +@checker("encode-string-with-shortest-length") +def encode_shortest(args: list[Any], expected: Any, actual: Any) -> bool: + """Decodes to s with every k[...] group shorter than its text, and is as short as the optimum.""" + s = args[0] + if not isinstance(actual, str) or len(actual) != len(expected): + return False + decoded, end = _decode(actual, 0, len(s)) + return end == len(actual) and decoded == s + + +def _long_division(digits: str, remainder: int, den: int) -> int | None: + """The remainder after checking `digits` are the next decimal digits of remainder/den, else None.""" + for d in digits: + remainder *= 10 + if int(d) != remainder // den: + return None + remainder %= den + return remainder + + +@checker("fraction-to-recurring-decimal") +def fraction_to_decimal(args: list[Any], expected: Any, actual: Any) -> bool: + """Exactly numerator/denominator: finite without trailing zeros if possible, else a parenthesized repetend.""" + num, den = args + m = _DECIMAL.fullmatch(actual) if isinstance(actual, str) else None + if not m: + return False + sign, whole, prefix, period = m.groups() + if (sign == "-") != (num * den < 0) or whole != str(abs(num) // abs(den)): + return False + if "." in actual and not prefix and period is None: + return False + den = abs(den) + remainder = _long_division(prefix or "", abs(num) % den, den) + if period is None: + return remainder == 0 and not (prefix or "").endswith("0") + return bool(remainder) and _long_division(period, remainder, den) == remainder + + +@checker("minimize-result-by-adding-parentheses-to-expression") +def minimize_result(args: list[Any], expected: Any, actual: Any) -> bool: + """The expression with "(" left of '+' and ")" right of it, evaluating to the optimal value.""" + + def value(expr: Any) -> int: + m = _EXPRESSION.fullmatch(expr) + if not m or expr.replace("(", "").replace(")", "") != args[0]: + raise ValueError("not a parenthesization of expression") + left, a, b, right = m.groups() + return int(left or 1) * (int(a) + int(b)) * int(right or 1) + + return isinstance(actual, str) and value(actual) == value(expected) + + +def _abbreviation(abbr: str) -> list[str | int] | None: + """Tokens of a well-formed abbreviation (letters and positive counts without leading zeros), else None.""" + tokens: list[str | int] = [] + for m in re.finditer(r"[a-z]|[1-9][0-9]*|.", abbr, re.DOTALL): + tok = m.group(0) + if tok.isascii() and tok.isdigit(): + tokens.append(int(tok)) + elif tok.isascii() and tok.islower(): + tokens.append(tok) + else: + return None + return tokens + + +def _abbreviates(tokens: list[str | int], word: str) -> bool: + i = 0 + for tok in tokens: + if isinstance(tok, int): + i += tok + elif i >= len(word) or word[i] != tok: + return False + else: + i += 1 + return i == len(word) + + +@checker("minimum-unique-word-abbreviation") +def minimum_unique_abbreviation(args: list[Any], expected: Any, actual: Any) -> bool: + """An abbreviation of target of optimal length that abbreviates no dictionary word.""" + target, dictionary = args + if not isinstance(actual, str): + return False + tokens, best = _abbreviation(actual), _abbreviation(expected) + if tokens is None or best is None or len(tokens) != len(best) or not _abbreviates(tokens, target): + return False + return not any(len(word) == len(target) and _abbreviates(tokens, word) for word in dictionary) + + +@checker("shortest-common-supersequence") +def shortest_common_supersequence(args: list[Any], expected: Any, actual: Any) -> bool: + """Has both strings as subsequences and the optimal length.""" + str1, str2 = args + return ( + isinstance(actual, str) + and len(actual) == len(expected) + and _is_subsequence(str1, actual) + and _is_subsequence(str2, actual) + ) + + +@checker("cracking-the-safe") +def cracking_the_safe(args: list[Any], expected: Any, actual: Any) -> bool: + """Digits below k of length k**n + n - 1 containing every n-digit password.""" + n, k = args + if not isinstance(actual, str) or len(actual) != k**n + n - 1 or len(actual) != len(expected): + return False + if not all(c.isascii() and c.isdigit() and int(c) < k for c in actual): + return False + return len({actual[i : i + n] for i in range(len(actual) - n + 1)}) == k**n + + +@checker("find-the-shortest-superstring") +def shortest_superstring(args: list[Any], expected: Any, actual: Any) -> bool: + """Contains every word as a substring and has the optimal length.""" + return isinstance(actual, str) and len(actual) == len(expected) and all(w in actual for w in args[0]) + + +@checker("build-an-array-with-stack-operations") +def build_array(args: list[Any], expected: Any, actual: Any) -> bool: + """Push/Pop over the stream 1..n that first makes the stack equal target on the last operation.""" + target, n = args + if not isinstance(actual, list) or not actual: + return False + stack: list[int] = [] + pushed = 0 + for i, op in enumerate(actual): + if op == "Push": + if pushed == n: + return False + pushed += 1 + stack.append(pushed) + elif op == "Pop" and stack: + stack.pop() + else: + return False + if stack == target: + return i == len(actual) - 1 + return False + + +def _cidr_range(block: Any) -> tuple[int, int]: + """The inclusive address range a canonical CIDR block (no host bits set) covers.""" + m = _CIDR.fullmatch(block) + if not m or not all(_no_leading_zero(g) for g in m.groups()): + raise ValueError("malformed CIDR block") + *octets, prefix = (int(g) for g in m.groups()) + if any(o > 255 for o in octets) or prefix > 32: + raise ValueError("malformed CIDR block") + start = int.from_bytes(bytes(octets), "big") + size = 1 << (32 - prefix) + if start & (size - 1): + raise ValueError("the base address has bits set beyond its prefix") + return start, start + size - 1 + + +@checker("ip-to-cidr") +def ip_to_cidr(args: list[Any], expected: Any, actual: Any) -> bool: + """As many CIDR blocks as the optimum, together covering exactly [ip, ip + n - 1].""" + ip, n = args + if not isinstance(actual, list) or len(actual) != len(expected): + return False + first = int.from_bytes(bytes(int(o) for o in ip.split(".")), "big") + nxt = first + for start, end in sorted(_cidr_range(b) for b in actual): + if start != nxt: + return False + nxt = end + 1 + return nxt == first + n diff --git a/backend/localcode/judging/checkers/graphs.py b/backend/localcode/judging/checkers/graphs.py new file mode 100644 index 0000000..4d79246 --- /dev/null +++ b/backend/localcode/judging/checkers/graphs.py @@ -0,0 +1,329 @@ +"""Answer checkers: graphs, trees and linked lists.""" + +import heapq +from collections import Counter +from itertools import pairwise +from typing import Any + +from localcode.judging.checkers import checker + +# A parsed binary tree: node values, then left and right child indexes (-1 for no child). Nodes are +# numbered in level order, so every child's index is greater than its parent's. +Tree = tuple[list[int], list[int], list[int]] + +MAX_LAKE = 10**9 +MAX_EDGE_WEIGHT = 2 * 10**9 + + +def _is_int(x: Any) -> bool: + return type(x) is int + + +def _is_permutation(x: Any, n: int) -> bool: + return isinstance(x, list) and len(x) == n and all(_is_int(v) and 0 <= v < n for v in x) and len(set(x)) == n + + +def _parse_tree(data: Any, *, strict: bool = True) -> Tree: + """Parse a level-order array like the harness; `strict` (for answers) rejects trailing `None`s and unused values.""" + if not isinstance(data, list): + raise TypeError("a tree must be a list") + vals: list[int] = [] + left: list[int] = [] + right: list[int] = [] + if not data or data[0] is None: + if strict and data: + raise ValueError("a non-empty tree must start with its root") + return vals, left, right + if strict and data[-1] is None: + raise ValueError("trailing None") + + def add(v: Any) -> int: + if not _is_int(v): + raise TypeError("tree values must be integers") + vals.append(v) + left.append(-1) + right.append(-1) + return len(vals) - 1 + + add(data[0]) + i, q = 1, 0 + while q < len(vals) and i < len(data): + for side in (left, right): + if i < len(data) and data[i] is not None: + side[q] = add(data[i]) + i += 1 + q += 1 + if strict and i < len(data): + raise ValueError("values left over after the last node") + return vals, left, right + + +def _inorder(t: Tree) -> list[int]: + vals, left, right = t + out: list[int] = [] + stack: list[int] = [] + node = 0 if vals else -1 + while stack or node != -1: + while node != -1: + stack.append(node) + node = left[node] + node = stack.pop() + out.append(vals[node]) + node = right[node] + return out + + +def _preorder(t: Tree, first: int = 0, second: int = 1) -> list[int]: + """Root, then subtrees; `first`/`second` pick the child order (0 = left, 1 = right).""" + vals, *children = t + out: list[int] = [] + stack = [0] if vals else [] + while stack: + node = stack.pop() + out.append(vals[node]) + stack.extend(c for c in (children[second][node], children[first][node]) if c != -1) + return out + + +def _postorder(t: Tree) -> list[int]: + return _preorder(t, first=1, second=0)[::-1] + + +def _is_bst_of(t: Tree, values: list[int]) -> bool: + order = _inorder(t) + return all(a < b for a, b in pairwise(order)) and order == sorted(values) + + +def _is_balanced(t: Tree) -> bool: + _, left, right = t + height = [0] * len(left) + for i in reversed(range(len(left))): + hl = height[left[i]] if left[i] != -1 else 0 + hr = height[right[i]] if right[i] != -1 else 0 + if abs(hl - hr) > 1: + return False + height[i] = 1 + max(hl, hr) + return True + + +def _shortest(adj: list[list[tuple[int, int]]], source: int, dest: int) -> float: + dist = [float("inf")] * len(adj) + dist[source] = 0 + heap = [(0, source)] + while heap: + d, u = heapq.heappop(heap) + if u == dest: + return d + if d > dist[u]: + continue + for v, w in adj[u]: + if d + w < dist[v]: + dist[v] = d + w + heapq.heappush(heap, (d + w, v)) + return dist[dest] + + +@checker("avoid-flood-in-the-city") +def avoid_flood(args: list[Any], expected: Any, actual: Any) -> bool: + """-1 on rainy days, a lake in [1, 1e9] dried on dry days, no lake rained on twice while full; [] iff impossible.""" + rains = args[0] + if expected == []: + return actual == [] + if not isinstance(actual, list) or len(actual) != len(rains): + return False + full: set[int] = set() + for lake, choice in zip(rains, actual, strict=True): + if not _is_int(choice): + return False + if lake > 0: + if choice != -1 or lake in full: + return False + full.add(lake) + elif 1 <= choice <= MAX_LAKE: + full.discard(choice) + else: + return False + return True + + +@checker("balance-a-binary-search-tree") +def balance_bst(args: list[Any], expected: Any, actual: Any) -> bool: + """A height-balanced BST holding exactly the input tree's values.""" + tree = _parse_tree(actual) + return _is_bst_of(tree, _parse_tree(args[0], strict=False)[0]) and _is_balanced(tree) + + +@checker("construct-binary-tree-from-preorder-and-postorder-traversal") +def tree_from_pre_post(args: list[Any], expected: Any, actual: Any) -> bool: + """A binary tree whose preorder and postorder traversals equal the given ones.""" + tree = _parse_tree(actual) + return _preorder(tree) == args[0] and _postorder(tree) == args[1] + + +@checker("course-schedule-ii") +def course_order(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of 0..n-1 taking every prerequisite first, or [] exactly when no order exists.""" + n, prerequisites = args + if expected == []: + return actual == [] + if not _is_permutation(actual, n): + return False + pos = {course: i for i, course in enumerate(actual)} + return all(pos[b] < pos[a] for a, b in prerequisites) + + +@checker("flower-planting-with-no-adjacent") +def garden_colouring(args: list[Any], expected: Any, actual: Any) -> bool: + """One flower type in 1..4 per garden, different across every path.""" + n, paths = args + if not isinstance(actual, list) or len(actual) != n or not all(_is_int(f) and 1 <= f <= 4 for f in actual): + return False + return all(actual[x - 1] != actual[y - 1] for x, y in paths) + + +@checker("insert-into-a-binary-search-tree") +def insert_into_bst(args: list[Any], expected: Any, actual: Any) -> bool: + """A BST holding exactly the original values plus `val`.""" + root, val = args + return _is_bst_of(_parse_tree(actual), [*_parse_tree(root, strict=False)[0], val]) + + +@checker("modify-graph-edge-weights") +def modify_edge_weights(args: list[Any], expected: Any, actual: Any) -> bool: + """Every edge once, given weights kept, -1s set within [1, 2e9], shortest path == target; [] iff impossible.""" + n, edges, source, destination, target = args + if expected == []: + return actual == [] + if not isinstance(actual, list) or len(actual) != len(edges): + return False + given = {frozenset((a, b)): w for a, b, w in edges} + seen: set[frozenset[int]] = set() + adj: list[list[tuple[int, int]]] = [[] for _ in range(n)] + for edge in actual: + if not isinstance(edge, list) or len(edge) != 3 or not all(_is_int(v) for v in edge): + return False + a, b, w = edge + key = frozenset((a, b)) + if key not in given or key in seen: + return False + fixed = given[key] + if (fixed == -1 and not 1 <= w <= MAX_EDGE_WEIGHT) or (fixed != -1 and w != fixed): + return False + seen.add(key) + adj[a].append((b, w)) + adj[b].append((a, w)) + return _shortest(adj, source, destination) == target + + +@checker("remove-zero-sum-consecutive-nodes-from-linked-list") +def remove_zero_sum(args: list[Any], expected: Any, actual: Any) -> bool: + """The list left after deleting zero-sum runs: a subsequence whose dropped gaps sum to 0, with no zero-sum run.""" + head = args[0] + if not isinstance(actual, list) or not all(_is_int(v) for v in actual): + return False + prefix, prefixes = 0, {0} + for v in actual: + prefix += v + if prefix in prefixes: + return False + prefixes.add(prefix) + if prefix != sum(head): + return False + matched = kept = dropped_before = 0 + for v in head: + if matched < len(actual) and v == actual[matched] and dropped_before == kept: + kept += v + matched += 1 + dropped_before += v + return matched == len(actual) + + +@checker("restore-the-array-from-adjacent-pairs") +def restore_from_pairs(args: list[Any], expected: Any, actual: Any) -> bool: + """n distinct integers whose adjacent pairs are exactly the given pairs.""" + pairs = args[0] + if not isinstance(actual, list) or len(actual) != len(pairs) + 1 or not all(_is_int(v) for v in actual): + return False + if len(set(actual)) != len(actual): + return False + return Counter(frozenset(p) for p in pairs) == Counter(frozenset(p) for p in pairwise(actual)) + + +@checker("sort-items-by-groups-respecting-dependencies") +def sort_items_by_groups(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of the items with every group contiguous and every beforeItems entry earlier; [] iff impossible.""" + n, _, group, before_items = args + if expected == []: + return actual == [] + if not _is_permutation(actual, n): + return False + pos = [0] * n + for i, item in enumerate(actual): + pos[item] = i + if any(pos[b] > pos[item] for item in range(n) for b in before_items[item]): + return False + spans: dict[int, list[int]] = {} + for item, g in enumerate(group): + if g != -1: + lo, hi, count = spans.setdefault(g, [pos[item], pos[item], 0]) + spans[g] = [min(lo, pos[item]), max(hi, pos[item]), count + 1] + return all(hi - lo + 1 == count for lo, hi, count in spans.values()) + + +@checker("the-most-similar-path-in-a-graph") +def most_similar_path(args: list[Any], expected: Any, actual: Any) -> bool: + """A path along roads, as long as targetPath, with the same (minimum) edit distance as the expected path.""" + n, roads, names, target_path = args + if not isinstance(actual, list) or len(actual) != len(target_path): + return False + if not all(_is_int(c) and 0 <= c < n for c in actual): + return False + adjacent = {(a, b) for a, b in roads} | {(b, a) for a, b in roads} + if not all(step in adjacent for step in pairwise(actual)): + return False + + def distance(path: list[int]) -> int: + return sum(names[c] != t for c, t in zip(path, target_path, strict=True)) + + return distance(actual) == distance(expected) + + +@checker("valid-arrangement-of-pairs") +def valid_arrangement(args: list[Any], expected: Any, actual: Any) -> bool: + """A reordering of the pairs where each pair starts where the previous one ends.""" + pairs = args[0] + if not isinstance(actual, list) or len(actual) != len(pairs): + return False + if not all(isinstance(p, list) and len(p) == 2 and all(_is_int(v) for v in p) for p in actual): + return False + if Counter(map(tuple, actual)) != Counter(map(tuple, pairs)): + return False + return all(prev[1] == cur[0] for prev, cur in pairwise(actual)) + + +@checker("smallest-sufficient-team") +def smallest_team(args: list[Any], expected: Any, actual: Any) -> bool: + """Distinct people covering every required skill, as few as the expected team.""" + req_skills, people = args + if not isinstance(actual, list) or len(actual) != len(expected) or len(set(actual)) != len(actual): + return False + if not all(_is_int(p) and 0 <= p < len(people) for p in actual): + return False + return set(req_skills) <= {skill for p in actual for skill in people[p]} + + +@checker("group-the-people-given-the-group-size-they-belong-to") +def group_people(args: list[Any], expected: Any, actual: Any) -> bool: + """A partition of 0..n-1 into groups where each person's group has their stated size.""" + sizes = args[0] + if not isinstance(actual, list): + return False + seen: set[int] = set() + for members in actual: + if not isinstance(members, list) or not members: + return False + for person in members: + if not _is_int(person) or not 0 <= person < len(sizes) or person in seen or sizes[person] != len(members): + return False + seen.add(person) + return len(seen) == len(sizes) diff --git a/backend/localcode/judging/checkers/grids.py b/backend/localcode/judging/checkers/grids.py new file mode 100644 index 0000000..4835d05 --- /dev/null +++ b/backend/localcode/judging/checkers/grids.py @@ -0,0 +1,231 @@ +"""Answer checkers: grids.""" + +from collections import Counter +from itertools import pairwise +from typing import Any + +from localcode.judging.checkers import checker + + +def _is_int(x: Any) -> bool: + return type(x) is int + + +def _int_matrix(m: Any, rows: int, cols: int) -> bool: + return ( + isinstance(m, list) + and len(m) == rows + and all(isinstance(r, list) and len(r) == cols and all(_is_int(x) for x in r) for r in m) + ) + + +@checker("build-a-matrix-with-conditions") +def build_matrix(args: list[Any], expected: Any, actual: Any) -> bool: + """A k x k matrix holding 1..k once each (zeros elsewhere) meeting every row and column condition, or [].""" + k, row_conditions, col_conditions = args + if expected == []: + return actual == [] + if not _int_matrix(actual, k, k): + return False + row: dict[int, int] = {} + col: dict[int, int] = {} + for r, line in enumerate(actual): + for c, v in enumerate(line): + if v == 0: + continue + if not 1 <= v <= k or v in row: + return False + row[v], col[v] = r, c + return ( + len(row) == k + and all(row[a] < row[b] for a, b in row_conditions) + and all(col[a] < col[b] for a, b in col_conditions) + ) + + +def _triangle_neighbors(i: int, j: int, n: int) -> list[tuple[int, int]]: + out = [(i, j - 1)] if j > 1 else [] + if j < 2 * i - 1: + out.append((i, j + 1)) + if j % 2 == 1 and i < n: + out.append((i + 1, j + 1)) + elif j % 2 == 0: + out.append((i - 1, j - 1)) + return out + + +@checker("color-the-triangle-red") +def color_red(args: list[Any], expected: Any, actual: Any) -> bool: + """Distinct valid triangles, as few as the expected answer, whose spread turns every triangle red.""" + (n,) = args + if not isinstance(actual, list) or len(actual) != len(expected): + return False + # red_hits[(i - 1) ** 2 + j - 1] counts red neighbours; 2 or more means the triangle is red. + red_hits = bytearray(n * n) + stack: list[tuple[int, int]] = [] + for cell in actual: + if not (isinstance(cell, list) and len(cell) == 2 and all(_is_int(x) for x in cell)): + return False + i, j = cell + if not (1 <= i <= n and 1 <= j <= 2 * i - 1) or red_hits[(i - 1) ** 2 + j - 1]: + return False + red_hits[(i - 1) ** 2 + j - 1] = 2 + stack.append((i, j)) + red = len(stack) + while stack: + for i, j in _triangle_neighbors(*stack.pop(), n): + idx = (i - 1) ** 2 + j - 1 + if red_hits[idx] < 2: + red_hits[idx] += 1 + if red_hits[idx] == 2: + red += 1 + stack.append((i, j)) + return red == n * n + + +@checker("construct-2d-grid-matching-graph-layout") +def construct_grid_layout(args: list[Any], expected: Any, actual: Any) -> bool: + """A rectangular grid holding 0..n-1 once each where cells are adjacent exactly when their nodes share an edge.""" + n, edges = args + if not isinstance(actual, list) or not actual or not isinstance(actual[0], list) or not actual[0]: + return False + rows, cols = len(actual), len(actual[0]) + if rows * cols != n or not _int_matrix(actual, rows, cols): + return False + if sorted(v for line in actual for v in line) != list(range(n)): + return False + edge_set = {(min(u, v), max(u, v)) for u, v in edges} + adjacent = 0 + for r in range(rows): + for c in range(cols): + a = actual[r][c] + for rr, cc in ((r + 1, c), (r, c + 1)): + if rr < rows and cc < cols: + b = actual[rr][cc] + if (min(a, b), max(a, b)) not in edge_set: + return False + adjacent += 1 + return adjacent == len(edge_set) + + +@checker("convert-an-array-into-a-2d-array-with-conditions") +def convert_to_2d(args: list[Any], expected: Any, actual: Any) -> bool: + """Rows of distinct values that together are exactly nums, with the minimal (expected) row count.""" + (nums,) = args + if not isinstance(actual, list) or len(actual) != len(expected): + return False + seen: Counter[int] = Counter() + for line in actual: + if not isinstance(line, list) or not all(_is_int(x) for x in line) or len(set(line)) != len(line): + return False + seen.update(line) + return seen == Counter(nums) + + +@checker("divide-array-into-arrays-with-max-difference") +def divide_array(args: list[Any], expected: Any, actual: Any) -> bool: + """Triples that together are exactly nums, each spanning at most k, or [] when impossible.""" + nums, k = args + if expected == []: + return actual == [] + if not isinstance(actual, list) or len(actual) * 3 != len(nums): + return False + seen: Counter[int] = Counter() + for group in actual: + if not (isinstance(group, list) and len(group) == 3 and all(_is_int(x) for x in group)): + return False + if max(group) - min(group) > k: + return False + seen.update(group) + return seen == Counter(nums) + + +@checker("map-of-highest-peak") +def highest_peak(args: list[Any], expected: Any, actual: Any) -> bool: + """Non-negative heights, 0 on water, neighbours differing by at most 1, with the maximal (expected) peak.""" + (is_water,) = args + rows, cols = len(is_water), len(is_water[0]) + if not _int_matrix(actual, rows, cols): + return False + for r in range(rows): + for c in range(cols): + h = actual[r][c] + if h < 0 or (is_water[r][c] and h != 0): + return False + if r + 1 < rows and abs(h - actual[r + 1][c]) > 1: + return False + if c + 1 < cols and abs(h - actual[r][c + 1]) > 1: + return False + return max(map(max, actual)) == max(map(max, expected)) + + +def _keeps_order(original: list[int], replaced: list[int]) -> bool: + ranked = [v for _, v in sorted(zip(original, replaced, strict=True))] + return all(a < b for a, b in pairwise(ranked)) + + +@checker("minimize-maximum-value-in-a-grid") +def minimize_grid_max(args: list[Any], expected: Any, actual: Any) -> bool: + """Positive values keeping every row's and column's relative order, with the minimal (expected) maximum.""" + (grid,) = args + rows, cols = len(grid), len(grid[0]) + if not _int_matrix(actual, rows, cols) or any(v < 1 for line in actual for v in line): + return False + if not all(_keeps_order(g, a) for g, a in zip(grid, actual, strict=True)): + return False + for c in range(cols): + if not _keeps_order([line[c] for line in grid], [line[c] for line in actual]): + return False + return max(map(max, actual)) == max(map(max, expected)) + + +@checker("reconstruct-a-2-row-binary-matrix") +def reconstruct_two_rows(args: list[Any], expected: Any, actual: Any) -> bool: + """A 2 x n binary matrix with the given row sums and column sums, or [] when none exists.""" + upper, lower, colsum = args + if expected == []: + return actual == [] + if not _int_matrix(actual, 2, len(colsum)) or any(v not in (0, 1) for line in actual for v in line): + return False + top, bottom = actual + return ( + sum(top) == upper + and sum(bottom) == lower + and all(a + b == s for a, b, s in zip(top, bottom, colsum, strict=True)) + ) + + +@checker("matrix-cells-in-distance-order") +def cells_by_distance(args: list[Any], expected: Any, actual: Any) -> bool: + """Every cell exactly once, in non-decreasing Manhattan distance from the centre.""" + rows, cols, r_center, c_center = args + if not isinstance(actual, list) or len(actual) != rows * cols: + return False + seen: set[tuple[int, int]] = set() + last = 0 + for cell in actual: + if not (isinstance(cell, list) and len(cell) == 2 and all(_is_int(x) for x in cell)): + return False + r, c = cell + if not (0 <= r < rows and 0 <= c < cols) or (r, c) in seen: + return False + seen.add((r, c)) + dist = abs(r - r_center) + abs(c - c_center) + if dist < last: + return False + last = dist + return True + + +@checker("find-a-good-subset-of-the-matrix") +def good_subset(args: list[Any], expected: Any, actual: Any) -> bool: + """Ascending distinct row indices of a non-empty subset whose column sums are at most half its size, or [].""" + (grid,) = args + if expected == []: + return actual == [] + if not isinstance(actual, list) or not actual or not all(_is_int(i) for i in actual): + return False + if not all(a < b for a, b in pairwise(actual)) or not 0 <= actual[0] <= actual[-1] < len(grid): + return False + limit = len(actual) // 2 + return all(sum(grid[i][c] for i in actual) <= limit for c in range(len(grid[0]))) diff --git a/backend/localcode/judging/checkers/numbers.py b/backend/localcode/judging/checkers/numbers.py new file mode 100644 index 0000000..96c8d87 --- /dev/null +++ b/backend/localcode/judging/checkers/numbers.py @@ -0,0 +1,173 @@ +"""Answer checkers: numbers.""" + +from collections import Counter +from itertools import pairwise +from typing import Any + +from localcode.judging.checkers import checker + +INT32_LIMIT = 2**31 + + +def _ints(xs: Any) -> bool: + return isinstance(xs, list) and all(type(x) is int for x in xs) + + +def _is_perm(xs: Any, lo: int, hi: int) -> bool: + """Whether `xs` is a permutation of the integers in [lo, hi].""" + return _ints(xs) and len(xs) == hi - lo + 1 and set(xs) == set(range(lo, hi + 1)) + + +def _one_bit_apart(a: int, b: int) -> bool: + return (a ^ b).bit_count() == 1 + + +def _is_gray_cycle(xs: Any, n: int, start: int) -> bool: + """Whether `xs` is a cyclic n-bit Gray code beginning at `start`.""" + return ( + _is_perm(xs, 0, (1 << n) - 1) + and xs[0] == start + and all(_one_bit_apart(xs[i - 1], xs[i]) for i in range(len(xs))) + ) + + +@checker("beautiful-arrangement-ii") +def beautiful_arrangement_ii(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of 1..n whose adjacent absolute differences take exactly k distinct values.""" + n, k = args + return _is_perm(actual, 1, n) and len({abs(a - b) for a, b in pairwise(actual)}) == k + + +@checker("beautiful-array") +def beautiful_array(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of 1..n with no i < k < j where 2 * nums[k] == nums[i] + nums[j].""" + (n,) = args + if not _is_perm(actual, 1, n): + return False + pos = [0] * (n + 1) + for i, v in enumerate(actual): + pos[v] = i + for k, mid in enumerate(actual): + twice = 2 * mid + for v in actual[:k]: + w = twice - v + if 1 <= w <= n and pos[w] > k: + return False + return True + + +@checker("circular-permutation-in-binary-representation") +def circular_permutation(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of 0..2^n-1 starting at `start` where cyclically adjacent values differ in one bit.""" + n, start = args + return _is_gray_cycle(actual, n, start) + + +@checker("convert-integer-to-the-sum-of-two-no-zero-integers") +def no_zero_integers(args: list[Any], expected: Any, actual: Any) -> bool: + """Two positive integers without a 0 digit that sum to n.""" + (n,) = args + return _ints(actual) and len(actual) == 2 and sum(actual) == n and all(x > 0 and "0" not in str(x) for x in actual) + + +@checker("di-string-match") +def di_string_match(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of 0..len(s) that rises at each 'I' and falls at each 'D'.""" + (s,) = args + return _is_perm(actual, 0, len(s)) and all( + (a < b) == (c == "I") for (a, b), c in zip(pairwise(actual), s, strict=True) + ) + + +@checker("find-array-given-subset-sums") +def find_array_given_subset_sums(args: list[Any], expected: Any, actual: Any) -> bool: + """n integers whose 2^n subset sums equal `sums` as a multiset.""" + n, sums = args + if not _ints(actual) or len(actual) != n: + return False + subset_sums = [0] + for x in actual: + subset_sums += [s + x for s in subset_sums] + return sorted(subset_sums) == sorted(sums) + + +@checker("find-missing-observations") +def find_missing_observations(args: list[Any], expected: Any, actual: Any) -> bool: + """n rolls in 1..6 bringing the overall mean to `mean`, or [] when no such rolls exist.""" + rolls, mean, n = args + if expected == []: + return actual == [] + return ( + _ints(actual) + and len(actual) == n + and all(1 <= x <= 6 for x in actual) + and sum(actual) == mean * (n + len(rolls)) - sum(rolls) + ) + + +@checker("find-n-unique-integers-sum-up-to-zero") +def sum_zero(args: list[Any], expected: Any, actual: Any) -> bool: + """n distinct integers that sum to 0.""" + (n,) = args + return _ints(actual) and len(actual) == n and len(set(actual)) == n and sum(actual) == 0 + + +@checker("gray-code") +def gray_code(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of 0..2^n-1 starting at 0 where cyclically adjacent values differ in one bit.""" + (n,) = args + return _is_gray_cycle(actual, n, 0) + + +@checker("largest-divisible-subset") +def largest_divisible_subset(args: list[Any], expected: Any, actual: Any) -> bool: + """A maximum-size subset of nums in which every pair divides one way.""" + (nums,) = args + if not _ints(actual) or len(actual) != len(expected) or len(set(actual)) != len(actual): + return False + if not set(actual) <= set(nums): + return False + chain = sorted(actual) + return all(b % a == 0 for a, b in pairwise(chain)) + + +@checker("maximum-points-in-an-archery-competition") +def maximum_bob_points(args: list[Any], expected: Any, actual: Any) -> bool: + """12 non-negative arrow counts summing to numArrows that score Bob the maximum points.""" + num_arrows, alice = args + + def score(bob: list[int]) -> int: + return sum(k for k, (a, b) in enumerate(zip(alice, bob, strict=True)) if b > a) + + return ( + _ints(actual) + and len(actual) == len(alice) + and all(x >= 0 for x in actual) + and sum(actual) == num_arrows + and score(actual) == score(expected) + ) + + +@checker("recover-the-original-array") +def recover_the_original_array(args: list[Any], expected: Any, actual: Any) -> bool: + """n positive integers arr with some k > 0 such that {a - k} + {a + k} equals nums as a multiset.""" + (nums,) = args + if not _ints(actual) or 2 * len(actual) != len(nums) or not actual or min(actual) < 1: + return False + k = min(actual) - min(nums) + return k > 0 and Counter(nums) == Counter([a - k for a in actual] + [a + k for a in actual]) + + +@checker("split-array-into-fibonacci-sequence") +def split_into_fibonacci(args: list[Any], expected: Any, actual: Any) -> bool: + """A split of num into at least 3 int32 values with f[i] + f[i+1] == f[i+2], or [] when none exists.""" + (num,) = args + if expected == []: + return actual == [] + return ( + _ints(actual) + and len(actual) >= 3 + and all(0 <= x < INT32_LIMIT for x in actual) + and all(a + b == c for a, b, c in zip(actual, actual[1:], actual[2:], strict=False)) + and "".join(map(str, actual)) == num + ) diff --git a/backend/localcode/judging/checkers/strings.py b/backend/localcode/judging/checkers/strings.py new file mode 100644 index 0000000..bcd8f04 --- /dev/null +++ b/backend/localcode/judging/checkers/strings.py @@ -0,0 +1,174 @@ +"""Answer checkers: strings.""" + +from collections import Counter +from itertools import groupby, pairwise +from string import ascii_lowercase +from typing import Any + +from localcode.judging.checkers import checker + +LOWERCASE = frozenset(ascii_lowercase) +PARENS = frozenset("()") + + +def _repeats(s: str, run: int) -> bool: + """Whether `s` has `run` equal characters in a row.""" + return any(len(list(g)) >= run for _, g in groupby(s)) + + +def _is_subsequence(sub: list[Any] | str, seq: list[Any] | str) -> bool: + it = iter(seq) + return all(any(x == y for y in it) for x in sub) + + +def _subsequence_indices(sub: list[Any], seq: list[Any]) -> list[int] | None: + """Indices of the earliest embedding of `sub` in `seq`, or None if it is not a subsequence.""" + indices, i = [], 0 + for x in sub: + while i < len(seq) and seq[i] != x: + i += 1 + if i == len(seq): + return None + indices.append(i) + i += 1 + return indices + + +@checker("custom-sort-string") +def custom_sort_string(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of `s` whose characters from `order` appear in `order`'s order.""" + order, s = args + rank = {c: i for i, c in enumerate(order)} + ranks = [rank[c] for c in actual if c in rank] + return isinstance(actual, str) and Counter(actual) == Counter(s) and all(x <= y for x, y in pairwise(ranks)) + + +@checker("find-unique-binary-string") +def find_unique_binary_string(args: list[Any], expected: Any, actual: Any) -> bool: + """A binary string of length n that is not in `nums`.""" + (nums,) = args + return isinstance(actual, str) and len(actual) == len(nums) and set(actual) <= {"0", "1"} and actual not in nums + + +@checker("generate-a-string-with-characters-that-have-odd-counts") +def odd_counts(args: list[Any], expected: Any, actual: Any) -> bool: + """`n` lowercase letters, each occurring an odd number of times.""" + (n,) = args + return ( + isinstance(actual, str) + and len(actual) == n + and set(actual) <= LOWERCASE + and all(k % 2 for k in Counter(actual).values()) + ) + + +@checker("longest-happy-string") +def longest_happy_string(args: list[Any], expected: Any, actual: Any) -> bool: + """An optimal-length string of at most a 'a', b 'b', c 'c', with no three equal letters in a row.""" + counts = Counter(actual) + return ( + isinstance(actual, str) + and len(actual) == len(expected) + and set(actual) <= set("abc") + and all(counts[ch] <= limit for ch, limit in zip("abc", args, strict=True)) + and not _repeats(actual, 3) + ) + + +@checker("minimum-remove-to-make-valid-parentheses") +def minimum_remove_parentheses(args: list[Any], expected: Any, actual: Any) -> bool: + """A balanced subsequence of `s` that keeps every letter and has the optimal length.""" + (s,) = args + if not isinstance(actual, str) or len(actual) != len(expected) or not _is_subsequence(actual, s): + return False + if [c for c in actual if c not in PARENS] != [c for c in s if c not in PARENS]: + return False + depth = 0 + for c in actual: + depth += (c == "(") - (c == ")") + if depth < 0: + return False + return depth == 0 + + +@checker("reorganize-string") +def reorganize_string(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of `s` with no two equal adjacent characters, or "" when none exists.""" + (s,) = args + if expected == "": + return actual == "" + return isinstance(actual, str) and Counter(actual) == Counter(s) and not _repeats(actual, 2) + + +@checker("replace-all-s-to-avoid-consecutive-repeating-characters") +def replace_question_marks(args: list[Any], expected: Any, actual: Any) -> bool: + """`s` with each '?' replaced by a lowercase letter and no two equal adjacent characters.""" + (s,) = args + return ( + isinstance(actual, str) + and len(actual) == len(s) + and set(actual) <= LOWERCASE + and all(o == "?" or o == a for o, a in zip(s, actual, strict=True)) + and not _repeats(actual, 2) + ) + + +@checker("sort-characters-by-frequency") +def sort_by_frequency(args: list[Any], expected: Any, actual: Any) -> bool: + """A permutation of `s` with each character's copies together, in non-increasing order of frequency.""" + (s,) = args + if not isinstance(actual, str) or Counter(actual) != Counter(s): + return False + runs = [len(list(g)) for _, g in groupby(actual)] + return len(runs) == len(set(actual)) and all(x >= y for x, y in pairwise(runs)) + + +@checker("string-without-aaa-or-bbb") +def string_without_aaa_or_bbb(args: list[Any], expected: Any, actual: Any) -> bool: + """Exactly a 'a' and b 'b' letters, with no three equal letters in a row.""" + a, b = args + return ( + isinstance(actual, str) + and len(actual) == a + b + and actual.count("a") == a + and actual.count("b") == b + and not _repeats(actual, 3) + ) + + +@checker("longest-duplicate-substring") +def longest_duplicate_substring(args: list[Any], expected: Any, actual: Any) -> bool: + """A substring of the optimal length that occurs at least twice in `s` (or "" when none exists).""" + (s,) = args + if expected == "": + return actual == "" + if not isinstance(actual, str) or not actual or len(actual) != len(expected): + return False + first = s.find(actual) + return first >= 0 and s.find(actual, first + 1) >= 0 + + +@checker("longest-unequal-adjacent-groups-subsequence-i") +def unequal_adjacent_groups_i(args: list[Any], expected: Any, actual: Any) -> bool: + """An optimal-length subsequence of `words` whose adjacent elements have different groups.""" + words, groups = args + if not isinstance(actual, list) or len(actual) != len(expected): + return False + indices = _subsequence_indices(actual, words) + return indices is not None and all(groups[i] != groups[j] for i, j in pairwise(indices)) + + +def _hamming_one(x: str, y: str) -> bool: + return len(x) == len(y) and sum(a != b for a, b in zip(x, y, strict=True)) == 1 + + +@checker("longest-unequal-adjacent-groups-subsequence-ii") +def unequal_adjacent_groups_ii(args: list[Any], expected: Any, actual: Any) -> bool: + """An optimal-length subsequence of `words` whose neighbours differ in group and are at Hamming distance 1.""" + words, groups = args + if not isinstance(actual, list) or len(actual) != len(expected): + return False + indices = _subsequence_indices(actual, words) + return indices is not None and all( + groups[i] != groups[j] and _hamming_one(words[i], words[j]) for i, j in pairwise(indices) + ) diff --git a/backend/localcode/judging/compare.py b/backend/localcode/judging/compare.py index d96a292..f6d346f 100644 --- a/backend/localcode/judging/compare.py +++ b/backend/localcode/judging/compare.py @@ -1,13 +1,39 @@ -"""Language-neutral judging of a solution's output against the expected value.""" +"""Language-neutral judging of a solution's output against the expected value. + +Modes (stored per problem as `compare_mode`): +- `exact`: equal, with a float tolerance. +- `any_order`: the top-level list may be in any order; inner values must match exactly. +- `any_order_deep`: lists may be in any order at every level (groups of sets, combinations). +- `each_any_order`: the top-level slots are fixed but each slot's list may be in any order. +- `checker:`: a per-problem checker validates the answer against the inputs. +""" import json from typing import Any +from localcode.judging.checkers import CHECKERS + FLOAT_TOL = 1e-5 +CHECKER_PREFIX = "checker:" + + +def _rounded(x: Any) -> Any: + if isinstance(x, float): + return round(x, 4) + return [_rounded(e) for e in x] if isinstance(x, list) else x def _sort_key(x: Any) -> str: - return json.dumps(x, sort_keys=True) + """A stable sort key; floats are rounded so values within FLOAT_TOL sort together.""" + return json.dumps(_rounded(x), sort_keys=True) + + +def _deep_sorted(x: Any) -> Any: + return sorted((_deep_sorted(e) for e in x), key=_sort_key) if isinstance(x, list) else x + + +def _sorted_slots(x: Any) -> Any: + return [sorted(e, key=_sort_key) if isinstance(e, list) else e for e in x] def _eq(expected: Any, actual: Any) -> bool: @@ -22,7 +48,21 @@ def _eq(expected: Any, actual: Any) -> bool: return expected == actual -def judge(expected: Any, actual: Any, mode: str = "exact") -> bool: - if mode == "any_order" and isinstance(expected, list) and isinstance(actual, list): +def judge(expected: Any, actual: Any, mode: str = "exact", args: list[Any] | None = None) -> bool: + """Whether `actual` is a correct answer; `args` are the case's inputs (needed by checkers).""" + if mode.startswith(CHECKER_PREFIX): + check = CHECKERS.get(mode.removeprefix(CHECKER_PREFIX)) + if check is not None: + try: + return bool(check(args or [], expected, actual)) + except Exception: # a malformed answer (wrong shape or type) is simply wrong + return False + mode = "exact" + both_lists = isinstance(expected, list) and isinstance(actual, list) + if mode == "any_order" and both_lists: return _eq(sorted(expected, key=_sort_key), sorted(actual, key=_sort_key)) + if mode == "any_order_deep" and both_lists: + return _eq(_deep_sorted(expected), _deep_sorted(actual)) + if mode == "each_any_order" and both_lists: + return _eq(_sorted_slots(expected), _sorted_slots(actual)) return _eq(expected, actual) diff --git a/backend/localcode/judging/verdicts.py b/backend/localcode/judging/verdicts.py index b9191cd..dbb473d 100644 --- a/backend/localcode/judging/verdicts.py +++ b/backend/localcode/judging/verdicts.py @@ -67,7 +67,7 @@ def grade_run(arg_lists: list[list[Any]], expected: list[Any], res: RunnerResult for i, (args, exp) in enumerate(zip(arg_lists, expected, strict=False)): r = res["results"][i] if i < len(res["results"]) else None if r and r.get("ok"): - passed = exp is not None and judge(exp, r["value"], mode) + passed = exp is not None and judge(exp, r["value"], mode, args) grade.cases.append( RunCase( args, @@ -111,7 +111,7 @@ def grade_submission(cases: list[Case], res: RunnerResult, mode: str) -> SubmitG return grade for i, case in enumerate(cases): r = res["results"][i] if i < len(res["results"]) else None - if r and r.get("ok") and judge(case["expected"], r["value"], mode): + if r and r.get("ok") and judge(case["expected"], r["value"], mode, case["args"]): grade.passed += 1 continue if r and r.get("ok"): diff --git a/backend/localcode/tools/check_checkers.py b/backend/localcode/tools/check_checkers.py new file mode 100644 index 0000000..2cba313 --- /dev/null +++ b/backend/localcode/tools/check_checkers.py @@ -0,0 +1,71 @@ +"""Maintainer tool: every answer checker must accept the dataset's own expected answers. + +For each problem with a checker, runs the checker on every test case that is not on the exclusion +list, passing the expected value as the answer. A rejection means the checker is wrong (or the case +is invalid and belongs on the exclusion list). Run it against a content.db built from the sources: + + docker compose exec -T -u localcode app python -m localcode.tools.check_checkers [--only slug ...] +""" + +import argparse +import json +import sqlite3 +import sys +from pathlib import Path + +from localcode import config +from localcode.importer.build import load_excluded +from localcode.importer.case_filter import case_key +from localcode.judging.checkers import CHECKERS +from localcode.judging.compare import CHECKER_PREFIX, judge + +MAX_REPORTED = 3 + + +def check(db: Path, excluded: dict[str, set[str]] | None = None, only: list[str] | None = None) -> dict[str, dict]: + """Per checked slug: how many cases were checked and the first few rejected ones.""" + excluded = load_excluded() if excluded is None else excluded + con = sqlite3.connect(f"{db.as_uri()}?mode=ro", uri=True) + report: dict[str, dict] = {} + try: + for slug in sorted(only or CHECKERS): + row = con.execute( + "select t.cases from problems p join tests t on t.slug = p.slug where p.slug = ? and p.has_tests = 1", + (slug,), + ).fetchone() + if not row: + report[slug] = {"error": "not a runnable problem"} + continue + skip = excluded.get(slug, set()) + cases = [c for c in json.loads(row[0]) if case_key(c["args"]) not in skip] + mode = f"{CHECKER_PREFIX}{slug}" + rejected = [c for c in cases if not judge(c["expected"], c["expected"], mode, c["args"])] + report[slug] = {"checked": len(cases), "rejected": rejected[:MAX_REPORTED], "rejected_count": len(rejected)} + finally: + con.close() + return report + + +def main(argv: list[str] | None = None) -> int: + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--db", type=Path, default=config.CONTENT_DB, help="content.db to read test cases from") + ap.add_argument("--only", nargs="*", help="limit to these problem slugs") + args = ap.parse_args(argv) + report = check(args.db, only=args.only) + bad = 0 + for slug, r in report.items(): + if "error" in r or r["rejected_count"]: + bad += 1 + detail = ( + r.get("error") + or f"rejects {r['rejected_count']}/{r['checked']}, e.g. {json.dumps(r['rejected'][0])[:300]}" + ) + print(f"FAIL {slug}: {detail}") + else: + print(f"ok {slug}: {r['checked']} cases") + print(f"{len(report) - bad}/{len(report)} checkers accept every expected answer") + return 1 if bad else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/backend/localcode/tools/validate_cases.py b/backend/localcode/tools/validate_cases.py index 10ea263..cfb4d8d 100644 --- a/backend/localcode/tools/validate_cases.py +++ b/backend/localcode/tools/validate_cases.py @@ -1,13 +1,17 @@ """Maintainer tool: find generated test cases that typed reference solutions reject. Runs the doocs Java and C++ reference solutions over every problem's suite and records cases that -every *trusted* typed reference fails (a reference is trusted when it passes most of the suite). -Those cases almost always violate the problem's constraints. The output is our own derived data, -shipped as localcode/data/excluded_cases.json and applied by the importer. +every *trusted* typed reference fails, or that one *confident* reference fails (see the thresholds). +Those cases almost always violate the problem's constraints: a correct typed solution crashes or +disagrees on them, while another language may get lucky (C++ reads out of bounds without crashing). +The output is our own derived data, shipped as localcode/data/excluded_cases.json and applied by the +importer. -Run inside the app container (it needs the runner and an imported content.db): +Run inside the app container with `make validate-cases`. It needs the runner and the downloaded sources; +`--from-sources DIR` first builds a content.db in DIR with no cases excluded, so every case is judged: - docker compose exec -u localcode app python -m localcode.tools.validate_cases /data/excluded_cases.json + docker compose exec -u localcode app python -m localcode.tools.validate_cases \ + --from-sources /data/validate /data/validate/excluded_cases.json """ import argparse @@ -18,31 +22,83 @@ import time from concurrent.futures import ThreadPoolExecutor from pathlib import Path +from typing import Any -from localcode import config +from localcode import config, db from localcode.db import content_session +from localcode.importer.build import MIN_CASES, build_content_db from localcode.importer.case_filter import case_key from localcode.judging import runner_client -from localcode.judging.compare import judge +from localcode.judging.compare import CHECKER_PREFIX, judge +# A reference is trusted when it passes at least TRUST_THRESHOLD of a suite; trusted references that +# agree on a failure exclude the case. A reference passing CONFIDENT_THRESHOLD excludes on its own. TRUST_THRESHOLD = 0.5 +CONFIDENT_THRESHOLD = 0.9 TIMEOUT_MS = 30_000 REFERENCE_LANGS = ("java", "cpp") def cases_to_exclude(outcomes: dict[str, list[bool]]) -> set[int]: - """Indices failed by every reference that passes at least TRUST_THRESHOLD of the suite.""" - trusted = [o for o in outcomes.values() if o and sum(o) / len(o) >= TRUST_THRESHOLD] + """Indices failed by every trusted reference, or by any confident one. + + When every reference (at least two) fails exactly the same cases, those are excluded however many + there are, as long as MIN_CASES survive: independent implementations agreeing case for case means + the inputs, not the references, are wrong (suites where most inputs break the constraints). + """ + present = [o for o in outcomes.values() if o] + failures = {frozenset(i for i, ok in enumerate(o) if not ok) for o in present} + if len(present) >= 2 and len(failures) == 1: + (agreed,) = failures + if len(present[0]) - len(agreed) >= MIN_CASES: + return set(agreed) + rates = {lang: sum(o) / len(o) for lang, o in outcomes.items() if o} + trusted = [outcomes[lang] for lang, rate in rates.items() if rate >= TRUST_THRESHOLD] + confident = [outcomes[lang] for lang, rate in rates.items() if rate >= CONFIDENT_THRESHOLD] if not trusted: return set() - return {i for i in range(len(trusted[0])) if not any(o[i] for o in trusted)} + return {i for i in range(len(trusted[0])) if not any(o[i] for o in trusted) or not all(o[i] for o in confident)} + + +def unjudgeable_cases(cases: list[dict], mode: str) -> set[int]: + """Cases whose recorded answer fails the problem's checker: no valid answer exists, or the record is + wrong. Either way no submission can be judged fairly on them, with or without a reference.""" + if not mode.startswith(CHECKER_PREFIX): + return set() + return {i for i, c in enumerate(cases) if not judge(c["expected"], c["expected"], mode, c["args"])} + + +def needs_review(outcomes: dict[str, list[bool]]) -> bool: + """Cases are excluded although no reference passes TRUST_THRESHOLD of the suite (agreement only). + + References are often translations of one algorithm and can share a bug or a limit, so these + exclusions are listed for a person to confirm that the inputs really break the constraints. + """ + rates = [sum(o) / len(o) for o in outcomes.values() if o] + return bool(cases_to_exclude(outcomes)) and max(rates, default=0) < TRUST_THRESHOLD + + +def differs_only_in_order(expected: Any, actual: Any, mode: str, args: list[Any]) -> bool: + """A wrong answer under `mode` that is right once list order is ignored at every level. + + Never true for a checker: it already accepts every valid ordering, so its rejections are real. + """ + if mode.startswith(CHECKER_PREFIX): + return False + return not judge(expected, actual, mode, args) and judge(expected, actual, "any_order_deep", args) def _outcomes( problem, lang: str, code: str, cases: list[dict], cpp_sig: dict | None, runner_url: str | None -) -> list[bool]: - """Per-case pass/fail. A case that hangs or crashes fails; the cases after it are run again.""" +) -> tuple[list[bool], list[bool]]: + """Per-case pass/fail, and which failures differ only in list order. + + Order-only differences still fail (an invalid input can look like a reordering), but are reported + so the problem's compare mode can be reviewed in `localcode.judging.answer_modes`. A case that hangs + or crashes fails; the cases after it are run again. + """ ok = [False] * len(cases) + order_only = [False] * len(cases) pending = list(range(len(cases))) while pending: chunk, pending = pending, [] @@ -61,13 +117,17 @@ def _outcomes( runner_url, ) if res["compile_error"]: - return [False] * len(cases) + return [False] * len(cases), order_only for i, r in zip(chunk, res["results"], strict=False): - ok[i] = bool(r.get("ok")) and judge(cases[i]["expected"], r["value"], problem["compare_mode"]) + if not r.get("ok"): + continue + expected, args = cases[i]["expected"], cases[i]["args"] + order_only[i] = differs_only_in_order(expected, r["value"], problem["compare_mode"], args) + ok[i] = judge(expected, r["value"], problem["compare_mode"], args) done = len(res["results"]) if done < len(chunk): # chunk[done] hung or crashed the process; retry what followed it pending = chunk[done + 1 :] - return ok + return ok, order_only def _load(slug: str) -> tuple[dict, list[dict], dict[str, str], dict | None]: @@ -82,27 +142,80 @@ def _load(slug: str) -> tuple[dict, list[dict], dict[str, str], dict | None]: return p, cases, codes, json.loads(cpp_row[0]) if cpp_row else None -def _validate_one(slug: str, runner_url: str) -> tuple[list[str], dict[str, str]]: +def _validate_one(slug: str, runner_url: str) -> tuple[list[str], dict[str, str], int, bool]: + """Case keys to exclude, a pass summary per language, how many cases differed only in order, and + whether the exclusions need review.""" p, cases, codes, cpp_sig = _load(slug) - outcomes = { + results = { lang: _outcomes(p, lang, codes[lang], cases, cpp_sig if lang == "cpp" else None, runner_url) for lang in REFERENCE_LANGS if lang in codes and lang in json.loads(p["langs"]) } - bad = cases_to_exclude(outcomes) - return sorted(case_key(cases[i]["args"]) for i in bad), {k: f"{sum(o)}/{len(o)}" for k, o in outcomes.items()} + outcomes = {lang: ok for lang, (ok, _) in results.items()} + order_only = sum(any(flags) for flags in zip(*(o for _, o in results.values()), strict=True)) if results else 0 + bad = cases_to_exclude(outcomes) | unjudgeable_cases(cases, p["compare_mode"]) + summary = {k: f"{sum(o)}/{len(o)}" for k, o in outcomes.items()} + return sorted(case_key(cases[i]["args"]) for i in bad), summary, order_only, needs_review(outcomes) + + +def prepare_from_sources(sources: Path, work: Path) -> None: + """Build `work/content.db` from `sources` with nothing excluded, and judge against it.""" + work.mkdir(parents=True, exist_ok=True) + (work / "content.db").unlink(missing_ok=True) # nothing may be carried forward from an older build + build_content_db(sources, work / "content.db", lambda *a: None, excluded={}) + db.CONTENT_DB, db.USER_DB = work / "content.db", work / "user.db" + +class _Report: + """A JSON object of slug -> finding, rewritten on every change; re-validating a slug replaces it.""" -def validate(out: Path, only: list[str] | None = None, runners: list[str] | None = None) -> dict[str, list[str]]: - """Validate every runnable problem, one worker per runner (default: every runner the app can reach).""" + def __init__(self, path: Path, keep: bool) -> None: + self.path = path + self.data: dict[str, object] = json.loads(path.read_text()) if keep and path.exists() else {} + self._write() + + def record(self, slug: str, finding: object | None) -> None: + if finding is None and slug not in self.data: + return + if finding is None: + del self.data[slug] + else: + self.data[slug] = finding + self._write() + + def _write(self) -> None: + self.path.write_text(json.dumps(self.data, indent=0, sort_keys=True)) + + +def _case_count(summary: dict[str, str]) -> int: + return max((int(s.split("/")[1]) for s in summary.values()), default=0) + + +def _runnable_slugs() -> list[str]: with content_session() as con: - slugs = [ - r[0] - for r in con.execute( - "select slug from problems where has_tests = 1 order by coalesce(frontend_id, 1000000000), slug" - ) - ] - result: dict[str, list[str]] = json.loads(out.read_text()) if out.exists() else {} + rows = con.execute( + "select slug from problems where has_tests = 1 order by coalesce(frontend_id, 1000000000), slug" + ) + return [r[0] for r in rows] + + +def validate( + out: Path, only: list[str] | None = None, runners: list[str] | None = None, *, fresh: bool = False +) -> dict[str, list[str]]: + """Validate every runnable problem, one worker per runner (default: every runner the app can reach). + + Resumes from `out` unless `fresh`; with `only`, re-validates those problems and keeps the rest. + + Two reports sit next to `out`, for a person to act on: + - `.order.json`: problems whose references differ from the expected answers only in list + order, with the number of such cases. Give each a compare mode, then re-run it with `--only`. + - `.review.json`: problems whose exclusions rest on references agreeing although none passes + half the suite (see `needs_review`), as `[excluded, total]`. Confirm the inputs are invalid. + """ + slugs = _runnable_slugs() + keep = not fresh + result: dict[str, list[str]] = json.loads(out.read_text()) if keep and out.exists() else {} + reports = {name: _Report(out.with_suffix(f".{name}.json"), keep) for name in ("order", "review")} todo = [s for s in slugs if s in only] if only else [s for s in slugs if s not in result] lock = threading.Lock() done = 0 @@ -115,14 +228,18 @@ def work(slug: str) -> None: nonlocal done url = pool_urls.get() try: - keys, summary = _validate_one(slug, url) + keys, summary, order_only, review = _validate_one(slug, url) finally: pool_urls.put(url) with lock: done += 1 result[slug] = keys out.write_text(json.dumps(result, indent=0, sort_keys=True)) - print(f"[{done}/{len(todo)}] {slug}: {summary} exclude {len(keys)}", flush=True) + reports["order"].record(slug, order_only or None) + reports["review"].record(slug, [len(keys), _case_count(summary)] if review else None) + note = f", {order_only} differ only in order" if order_only else "" + note += ", needs review" if review else "" + print(f"[{done}/{len(todo)}] {slug}: {summary} exclude {len(keys)}{note}", flush=True) with ThreadPoolExecutor(max_workers=max(1, len(targets))) as pool: for f in [pool.submit(work, s) for s in todo]: @@ -132,7 +249,13 @@ def work(slug: str) -> None: def main(argv: list[str] | None = None) -> int: ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) - ap.add_argument("out", type=Path, help="JSON file to write (resumes if it exists)") + ap.add_argument("out", type=Path, help="JSON file to write (resumes if it exists, unless --from-sources)") + ap.add_argument( + "--from-sources", + type=Path, + metavar="DIR", + help="first build an unfiltered content.db in DIR from the downloaded sources and start a fresh list", + ) ap.add_argument("--only", nargs="*", help="limit to these problem slugs") ap.add_argument( "--runners", @@ -140,8 +263,10 @@ def main(argv: list[str] | None = None) -> int: help="runner endpoints to spread work across (default: every runner socket the app can see)", ) args = ap.parse_args(argv) + if args.from_sources: + prepare_from_sources(config.SOURCES_DIR, args.from_sources) t0 = time.time() - result = validate(args.out, args.only, args.runners) + result = validate(args.out, args.only, args.runners, fresh=bool(args.from_sources and not args.only)) print( f"done: {sum(map(len, result.values()))} cases excluded across {len(result)} problems " f"in {time.time() - t0:.0f}s", diff --git a/backend/localcode/tools/validate_content.py b/backend/localcode/tools/validate_content.py index 3cfe99d..39fce9c 100644 --- a/backend/localcode/tools/validate_content.py +++ b/backend/localcode/tools/validate_content.py @@ -59,7 +59,7 @@ def _run(execute: Execute, p: sqlite3.Row, lang: str, code: str, cases: list[dic r = results[i] if not r.get("ok"): return f"raised on case {i + 1}: args {_short(case['args'])}: {str(r.get('error', ''))[:300]}" - if not judge(case["expected"], r["value"], p["compare_mode"]): + if not judge(case["expected"], r["value"], p["compare_mode"], case["args"]): return ( f"fails case {i + 1}: args {_short(case['args'])}, expected {_short(case['expected'])}, " f"got {_short(r['value'])}" diff --git a/backend/tests/test_build.py b/backend/tests/test_build.py index 5603f0c..33fd078 100644 --- a/backend/tests/test_build.py +++ b/backend/tests/test_build.py @@ -352,3 +352,24 @@ def test_local_solutions_kept_when_whole_folder_removed(tmp_path): rebuild(tmp_path, CONTENT) con, _ = rebuild(tmp_path, tmp_path / "empty") assert [r[0] for r in con.execute("select title from solutions where slug='count-vowels'")] == ["Single scan"] + + +def test_checker_and_curated_modes_set_compare_mode(tmp_path, monkeypatch): + from localcode.judging import answer_modes, checkers + + monkeypatch.setitem(checkers.CHECKERS, "pair-sum", lambda args, expected, actual: True) + monkeypatch.setitem(answer_modes.MODES, "tree-mirror", "any_order_deep") + con, _ = build_with_content(tmp_path, tmp_path / "none") + modes = dict(con.execute("select slug, compare_mode from problems")) + assert modes["pair-sum"] == "checker:pair-sum" + assert modes["tree-mirror"] == "any_order_deep" + assert modes["list-reverse"] == "exact" + + +def test_local_compare_overrides_the_registry(tmp_path, monkeypatch): + from localcode.judging import checkers + + monkeypatch.setitem(checkers.CHECKERS, "pair-sum", lambda args, expected, actual: True) + content = write_content(tmp_path / "c", "pair-sum", {"problem.md": "---\ncompare: any_order\n---\n"}) + con, _ = build_with_content(tmp_path, content) + assert con.execute("select compare_mode from problems where slug='pair-sum'").fetchone()[0] == "any_order" diff --git a/backend/tests/test_check_checkers.py b/backend/tests/test_check_checkers.py new file mode 100644 index 0000000..ee849a5 --- /dev/null +++ b/backend/tests/test_check_checkers.py @@ -0,0 +1,21 @@ +from localcode.judging import checkers +from localcode.tools.check_checkers import check + + +def test_reports_checkers_that_reject_the_expected_answer(data_dir, monkeypatch): + monkeypatch.setitem(checkers.CHECKERS, "pair-sum", lambda args, expected, actual: actual[0] < actual[1]) + monkeypatch.setitem(checkers.CHECKERS, "tree-mirror", lambda args, expected, actual: False) + report = check(data_dir / "content.db", excluded={}) + assert report["pair-sum"]["checked"] == 4 and report["pair-sum"]["rejected"] == [] + assert report["tree-mirror"]["rejected"] and report["tree-mirror"]["checked"] > 0 + + +def test_skips_excluded_cases_and_flags_unknown_slugs(data_dir, monkeypatch): + from localcode.importer.case_filter import case_key + + monkeypatch.setitem(checkers.CHECKERS, "pair-sum", lambda args, expected, actual: args[1] != 10) + monkeypatch.setitem(checkers.CHECKERS, "no-such-problem", lambda args, expected, actual: True) + excluded = {"pair-sum": {case_key([[1, 4, 6], 10]), case_key([[5, 5], 10])}} + report = check(data_dir / "content.db", excluded=excluded) + assert report["no-such-problem"]["error"] == "not a runnable problem" + assert report["pair-sum"]["checked"] == 2 and report["pair-sum"]["rejected"] == [] diff --git a/backend/tests/test_checkers_arrays.py b/backend/tests/test_checkers_arrays.py new file mode 100644 index 0000000..48c4540 --- /dev/null +++ b/backend/tests/test_checkers_arrays.py @@ -0,0 +1,172 @@ +from typing import Any + +import pytest + +from localcode.judging.compare import judge + +# (slug, args, expected, valid answers (statement example first), invalid answers) +CASES: list[tuple[str, list[Any], Any, list[Any], list[Any]]] = [ + ( + "advantage-shuffle", + [[2, 7, 11, 15], [1, 10, 4, 11]], + [2, 11, 7, 15], + [[2, 11, 7, 15]], + [[7, 11, 2, 15], [2, 11, 7], [2, 11, 7, 16], [2, 11, 7, 15, 1]], + ), + ( + "advantage-shuffle", + [[5, 6, 7], [1, 1, 10]], + [5, 6, 7], + [[5, 6, 7], [7, 6, 5]], + [[5, 7, 10], [5, 6], [5, 6, 8]], + ), + ( + "array-with-elements-not-equal-to-average-of-neighbors", + [[1, 2, 3, 4, 5]], + [1, 2, 4, 5, 3], + [[1, 2, 4, 5, 3], [1, 3, 2, 5, 4]], + [[1, 2, 3, 4, 5], [1, 2, 4, 5], [1, 2, 4, 5, 6]], + ), + ( + "distant-barcodes", + [[1, 1, 1, 2, 2, 2]], + [2, 1, 2, 1, 2, 1], + [[2, 1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 2]], + [[1, 1, 2, 2, 1, 2], [1, 2, 1, 2, 1], [1, 2, 1, 2, 1, 3]], + ), + ( + "find-anagram-mappings", + [[12, 28, 46, 32, 50, 12], [50, 12, 32, 46, 28, 12]], + [1, 4, 3, 2, 0, 5], + [[1, 4, 3, 2, 0, 5], [5, 4, 3, 2, 0, 1]], + [[0, 4, 3, 2, 0, 5], [1, 4, 3, 2, 0], [1, 4, 3, 2, 0, 6], [1, 4, 3, 2, 0, -1]], + ), + ( + "find-indices-with-index-and-value-difference-i", + [[5, 1, 4, 1], 2, 4], + [0, 3], + [[0, 3], [3, 0]], + [[0, 2], [1, 3], [-1, -1], [0, 4], [0, 3, 1]], + ), + ( + "find-indices-with-index-and-value-difference-ii", + [[2, 1], 0, 0], + [0, 0], + [[0, 0], [1, 0], [1, 1]], + [[-1, -1], [0, 2], [0]], + ), + ( + "find-indices-with-index-and-value-difference-ii", + [[1, 2, 3], 2, 4], + [-1, -1], + [[-1, -1]], + [[0, 2], [-1]], + ), + ( + "find-subsequence-of-length-k-with-the-largest-sum", + [[3, 4, 3, 3], 2], + [3, 4], + [[3, 4], [4, 3]], + [[3, 3], [4, 4], [3, 4, 3], [5, 2]], + ), + ( + "sort-array-by-parity", + [[3, 1, 2, 4]], + [2, 4, 3, 1], + [[2, 4, 3, 1], [4, 2, 1, 3]], + [[2, 3, 4, 1], [2, 4, 3], [2, 4, 3, 5]], + ), + ( + "sort-array-by-parity-ii", + [[4, 2, 5, 7]], + [4, 5, 2, 7], + [[4, 5, 2, 7], [2, 7, 4, 5]], + [[4, 2, 5, 7], [4, 5, 2], [4, 5, 6, 7]], + ), + ( + "neither-minimum-nor-maximum", + [[3, 2, 1, 4]], + 2, + [2, 3], + [1, 4, 5, -1, [2]], + ), + ( + "neither-minimum-nor-maximum", + [[1, 2]], + -1, + [-1], + [1, 2], + ), + ( + "subarray-with-elements-greater-than-varying-threshold", + [[6, 5, 6, 5, 8], 7], + 1, + [1, 2, 3, 4, 5], + [0, 6, -1, True], + ), + ( + "subarray-with-elements-greater-than-varying-threshold", + [[1, 3, 4, 3, 1], 6], + 3, + [3], + [1, 2, 4, -1], + ), + ( + "three-equal-parts", + [[1, 0, 1, 0, 1]], + [0, 3], + [[0, 3]], + [[0, 2], [1, 3], [-1, -1], [0, 5]], + ), + ( + "three-equal-parts", + [[0, 0, 0, 0]], + [0, 2], + [[0, 2], [1, 3], [0, 3]], + [[0, 1], [2, 4], [-1, -1]], + ), + ( + "three-equal-parts", + [[1, 1, 0, 1, 1]], + [-1, -1], + [[-1, -1]], + [[0, 2], [1, 3]], + ), + ( + "maximum-nesting-depth-of-two-valid-parentheses-strings", + ["(()())"], + [0, 1, 1, 1, 1, 0], + [[0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1]], + [[0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 1, 0], [0, 1, 1, 1, 1], [0, 1, 1, 1, 1, 2]], + ), + ( + "fair-candy-swap", + [[1, 2], [2, 3]], + [1, 2], + [[1, 2], [2, 3]], + [[2, 2], [1, 3], [3, 4], [1]], + ), +] + + +@pytest.mark.parametrize(("slug", "args", "expected", "valid", "invalid"), CASES, ids=[c[0] for c in CASES]) +def test_checker(slug: str, args: list[Any], expected: Any, valid: list[Any], invalid: list[Any]) -> None: + mode = f"checker:{slug}" + for answer in valid: + assert judge(expected, answer, mode, args), f"{slug} rejected valid {answer}" + for answer in invalid: + assert not judge(expected, answer, mode, args), f"{slug} accepted invalid {answer}" + + +def test_find_k_pairs_with_smallest_sums(): + slug = "checker:find-k-pairs-with-smallest-sums" + args = [[1, 1, 2], [1, 2, 3], 2] + expected = [[1, 1], [1, 1]] + assert judge(expected, [[1, 1], [1, 1]], slug, args) + tie = [[1, 2, 4], [1, 3], 2] # sums 2, then 3 and 3 tie for second place + assert judge([[1, 1], [2, 1]], [[1, 1], [2, 1]], slug, tie) + assert judge([[1, 1], [2, 1]], [[2, 1], [1, 1]], slug, tie) # any order + assert not judge([[1, 1], [2, 1]], [[1, 1], [1, 3]], slug, tie) # sum 4 is not among the 2 smallest + assert not judge(expected, [[1, 1], [1, 1], [1, 1]], slug, args) # wrong count + assert not judge(expected, [[1, 1], [5, 1]], slug, args) # 5 is not in nums1 + assert not judge([[1, 1], [1, 2]], [[1, 1], [1, 1]], slug, [[1], [1, 2], 2]) # (1, 1) exists only once diff --git a/backend/tests/test_checkers_encodings.py b/backend/tests/test_checkers_encodings.py new file mode 100644 index 0000000..1ae2048 --- /dev/null +++ b/backend/tests/test_checkers_encodings.py @@ -0,0 +1,163 @@ +from typing import Any + +import pytest + +from localcode.judging.compare import judge + + +def accepts(slug: str, args: list[Any], expected: Any, actual: Any) -> bool: + return judge(expected, actual, f"checker:{slug}", args) + + +CASES = [ + ( + "alien-dictionary", + [["wrt", "wrf", "er", "ett", "rftt"]], + "wertf", + ["wertf"], + ["wetrf", "werf", "wertff", "wrtef", 42], + ), + ("alien-dictionary", [["z", "x"]], "zx", ["zx"], ["xz", "z", ""]), + ("alien-dictionary", [["ab", "adc"]], "abcd", ["abcd", "cabd", "abdc", "bacd"], ["adbc", "abc"]), + ("alien-dictionary", [["z", "x", "z"]], "", [""], ["zx", "xz"]), + ("alien-dictionary", [["abc", "ab"]], "", [""], ["abc", "cba"]), + ( + "alphabet-board-path", + ["leet"], + "DDR!UURRR!!DDD!", + ["DDR!UURRR!!DDD!", "RDD!RRRUU!!DDD!"], + ["DDR!UURRR!!DDDD!U", "DDR!UURRR!!DD!", "RDD!RRRUU!!DDD"], + ), + ( + "alphabet-board-path", + ["zd"], + "DDDDD!UUUUURRR!", + ["DDDDD!UUUUURRR!", "DDDDD!UURRRUUU!"], + ["DDDDD!RRRUUUUU!", "DDDDD!UUUUURRRR!", "DDDDD!UUUUURRX!"], + ), + ( + "encode-string-with-shortest-length", + ["aaaaaaaaaa"], + "10[a]", + ["10[a]", "a9[a]", "9[a]a", "5[aa]"], + ["9[b]a", "10[a", "10[]a", "2[5[a]]", "010[a]", "aaaaaaaaaa"], + ), + ("encode-string-with-shortest-length", ["aaaaa"], "5[a]", ["5[a]"], ["aaaaa", "5[a", "5[b]", "4[a]a"]), + ("encode-string-with-shortest-length", ["aaaa"], "aaaa", ["aaaa"], ["4[a]", "2[aa]", "aaa"]), + ("encode-string-with-shortest-length", ["abbbabbbcabbbabbbc"], "2[2[abbb]c]", ["2[2[abbb]c]"], ["2[2[a3b]c]"]), + ("fraction-to-recurring-decimal", [1, 2], "0.5", ["0.5"], ["0.50", "0.5(0)", "0.4(9)", ".5", "00.5"]), + ("fraction-to-recurring-decimal", [2, 1], "2", ["2"], ["2.", "2.0", "2.(0)", "1.(9)", "-2"]), + ( + "fraction-to-recurring-decimal", + [4, 333], + "0.(012)", + ["0.(012)", "0.0(120)", "0.(012012)", "0.012(012)"], + ["0.(012", "0.01(2)", "0.012", "-0.(012)"], + ), + ("fraction-to-recurring-decimal", [7, -3], "-2.(3)", ["-2.(3)", "-2.3(3)"], ["2.(3)", "-2.(4)", "-2.33"]), + ("fraction-to-recurring-decimal", [0, -5], "0", ["0"], ["-0", "0.0"]), + ( + "minimize-result-by-adding-parentheses-to-expression", + ["247+38"], + "2(47+38)", + ["2(47+38)"], + ["(247+38)", "2(4)7+38", "2(47+3)8", "2(47+38", "3(47+38)"], + ), + ( + "minimize-result-by-adding-parentheses-to-expression", + ["12+16"], + "1(2+1)6", + ["1(2+1)6", "1(2+16)"], + ["(12+16)", "12+16", "1(2+1)6 ", "1(2+)16"], + ), + ("minimum-unique-word-abbreviation", ["apple", ["blade"]], "a4", ["a4"], ["4e", "5", "a3e", "a04"]), + ( + "minimum-unique-word-abbreviation", + ["apple", ["blade", "plain", "amber"]], + "1p3", + ["1p3", "2p2", "3l1"], + ["a4", "4e", "1p2e", "1q3", "p4"], + ), + ( + "shortest-common-supersequence", + ["abac", "cab"], + "cabac", + ["cabac"], + ["cabacx", "abac", "cbaac", "cabab"], + ), + ("shortest-common-supersequence", ["ab", "ba"], "aba", ["aba", "bab"], ["abba", "ab", "baa"]), + ( + "cracking-the-safe", + [2, 2], + "01100", + ["01100", "10011", "11001", "00110"], + ["01101", "011000", "0110", "01120", "0 110"], + ), + ("cracking-the-safe", [1, 2], "10", ["10", "01"], ["11", "102", "1"]), + ( + "find-the-shortest-superstring", + [["alex", "loves", "leetcode"]], + "alexlovesleetcode", + ["alexlovesleetcode", "leetcodelovesalex", "lovesalexleetcode"], + ["alexlovesleetcod", "alexlovesleetcodex", "alexleetcodelovez"], + ), + ( + "build-an-array-with-stack-operations", + [[1, 3], 3], + ["Push", "Push", "Pop", "Push"], + [["Push", "Push", "Pop", "Push"]], + [["Push", "Push", "Push"], ["Push", "Push", "Pop", "Push", "Push", "Pop"], ["Push", "Pop", "Push"], "Push"], + ), + ( + "build-an-array-with-stack-operations", + [[3], 3], + ["Push", "Pop", "Push", "Pop", "Push"], + [["Push", "Pop", "Push", "Pop", "Push"], ["Push", "Push", "Pop", "Pop", "Push"]], + [["Push", "Push", "Push"], ["Pop", "Push", "Push", "Pop", "Pop", "Push"], ["Push", "Pop", "Push", "Pop"]], + ), + ( + "build-an-array-with-stack-operations", + [[1, 2], 4], + ["Push", "Push"], + [["Push", "Push"]], + [["Push", "Push", "Push", "Pop"], ["Push", "Push", "Pop", "Push"], ["Push", "push"]], + ), + ( + "ip-to-cidr", + ["255.0.0.7", 10], + ["255.0.0.7/32", "255.0.0.8/29", "255.0.0.16/32"], + [ + ["255.0.0.7/32", "255.0.0.8/29", "255.0.0.16/32"], + ["255.0.0.16/32", "255.0.0.7/32", "255.0.0.8/29"], + ], + [ + ["255.0.0.7/32", "255.0.0.15/29", "255.0.0.16/32"], + ["255.0.0.0/28"], + ["255.0.0.7/32", "255.0.0.8/29"], + ["255.0.0.7/32", "255.0.0.8/30", "255.0.0.12/30", "255.0.0.16/32"], + ["255.0.0.07/32", "255.0.0.8/29", "255.0.0.16/32"], + ["255.0.0.7/32", "255.0.0.8/29", "255.0.0.16/33"], + ], + ), +] + + +@pytest.mark.parametrize(("slug", "args", "expected", "valid", "invalid"), CASES) +def test_checker(slug: str, args: list[Any], expected: Any, valid: list[Any], invalid: list[Any]) -> None: + assert valid[0] == expected + for answer in valid: + assert accepts(slug, args, expected, answer), answer + for answer in invalid: + assert not accepts(slug, args, expected, answer), answer + + +def test_every_slug_has_a_different_valid_answer() -> None: + assert {slug for slug, *_ in CASES} == {slug for slug, _, _, valid, _ in CASES if len(valid) > 1} + + +def test_ip_to_cidr_requires_canonical_block_addresses(): + slug = "checker:ip-to-cidr" + args = ["255.0.0.7", 10] + expected = ["255.0.0.7/32", "255.0.0.8/29", "255.0.0.16/32"] + assert judge(expected, expected, slug, args) + assert not judge(expected, ["255.0.0.7/32", "255.0.0.15/29", "255.0.0.16/32"], slug, args) diff --git a/backend/tests/test_checkers_graphs.py b/backend/tests/test_checkers_graphs.py new file mode 100644 index 0000000..4ffc7a6 --- /dev/null +++ b/backend/tests/test_checkers_graphs.py @@ -0,0 +1,199 @@ +from typing import Any + +import pytest + +from localcode.judging.compare import judge + +# slug, args, expected (the statement's answer), other valid answers, invalid answers +CASES: list[tuple[str, list[Any], Any, list[Any], list[Any]]] = [ + ( + "avoid-flood-in-the-city", + [[1, 2, 0, 0, 2, 1]], + [-1, -1, 2, 1, -1, -1], + [[-1, -1, 1, 2, -1, -1]], + [[-1, -1, 2, 2, -1, -1], [-1, -1, 0, 1, -1, -1], [-1, -1, 2, 1, -1], [], [-1, -1, 2.0, 1, -1, -1]], + ), + ("avoid-flood-in-the-city", [[1, 2, 0, 1, 2]], [], [], [[-1, -1, 1, -1, -1], [-1, -1, 2, -1, -1]]), + ( + "avoid-flood-in-the-city", + [[1, 0, 2, 0, 1]], + [-1, 1, -1, 5, -1], + [[-1, 9, -1, 1, -1]], + [[-1, 2, -1, 2, -1], [-1, 1, -1, 1_000_000_001, -1]], + ), + ( + "balance-a-binary-search-tree", + [[1, None, 2, None, 3, None, 4, None, None]], + [2, 1, 3, None, None, None, 4], + [[3, 1, 4, None, 2], [2, 1, 4, None, None, 3], [3, 2, 4, 1]], + [ + [1, None, 2, None, 3, None, 4], + [2, 1, 3], + [2, 1, 3, None, None, None, 5], + [3, 1, 4, 2], + [3, 1, 4, None, 2, None], + ], + ), + ( + "construct-binary-tree-from-preorder-and-postorder-traversal", + [[1, 2, 4, 5, 3, 6, 7], [4, 5, 2, 6, 7, 3, 1]], + [1, 2, 3, 4, 5, 6, 7], + [], + [[1, 3, 2, 6, 7, 4, 5], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6, 7, None]], + ), + ( + "construct-binary-tree-from-preorder-and-postorder-traversal", + [[1, 2, 3], [3, 2, 1]], + [1, 2, None, 3], + [[1, None, 2, None, 3], [1, 2, None, None, 3], [1, None, 2, 3]], + [[1, 2, 3], [1, 3, None, 2], [None, 1, 2, None, 3]], + ), + ( + "course-schedule-ii", + [4, [[1, 0], [2, 0], [3, 1], [3, 2]]], + [0, 2, 1, 3], + [[0, 1, 2, 3]], + [[0, 1, 3, 2], [0, 1, 2], [0, 1, 1, 3], [], [0, 1, 2, 4]], + ), + ("course-schedule-ii", [2, [[1, 0], [0, 1]]], [], [], [[0, 1], [1, 0]]), + ( + "flower-planting-with-no-adjacent", + [3, [[1, 2], [2, 3], [3, 1]]], + [1, 2, 3], + [[1, 2, 4], [1, 4, 2], [3, 2, 1]], + [[1, 2, 1], [1, 2, 5], [0, 1, 2], [1, 2]], + ), + ( + "insert-into-a-binary-search-tree", + [[4, 2, 7, 1, 3], 5], + [4, 2, 7, 1, 3, 5], + [[5, 2, 7, 1, 3, None, None, None, None, None, 4], [3, 2, 5, 1, None, 4, 7]], + [[4, 2, 7, 1, 3, None, 5], [4, 2, 7, 1, 3], [4, 2, 7, 1, 3, 5, None], [4, 2, 7, 1, 3, 6]], + ), + ("insert-into-a-binary-search-tree", [[], 5], [5], [], [[], [5, None], [5, 5]]), + ( + "modify-graph-edge-weights", + [5, [[4, 1, -1], [2, 0, -1], [0, 3, -1], [4, 3, -1]], 0, 1, 5], + [[4, 1, 1], [2, 0, 1], [0, 3, 3], [4, 3, 1]], + [[[0, 3, 1], [1, 4, 3], [2, 0, 2000000000], [4, 3, 1]]], + [ + [[4, 1, 1], [2, 0, 1], [0, 3, 1], [4, 3, 1]], + [[4, 1, 1], [2, 0, 0], [0, 3, 3], [4, 3, 1]], + [[4, 1, 1], [0, 3, 3], [4, 3, 1]], + [[4, 1, 1], [2, 0, 1], [0, 3, 3], [4, 3, 1], [4, 3, 1]], + [[4, 1, 1], [2, 1, 1], [0, 3, 3], [4, 3, 1]], + [], + ], + ), + ( + "modify-graph-edge-weights", + [4, [[1, 0, 4], [1, 2, 3], [2, 3, 5], [0, 3, -1]], 0, 2, 6], + [[1, 0, 4], [1, 2, 3], [2, 3, 5], [0, 3, 1]], + [], + [[[1, 0, 4], [1, 2, 3], [2, 3, 5], [0, 3, 2]], [[1, 0, 5], [1, 2, 2], [2, 3, 5], [0, 3, 1]]], + ), + ("modify-graph-edge-weights", [3, [[0, 1, -1], [0, 2, 5]], 0, 2, 6], [], [], [[[0, 1, 1], [0, 2, 5]]]), + ( + "remove-zero-sum-consecutive-nodes-from-linked-list", + [[1, 2, -3, 3, 1]], + [3, 1], + [[1, 2, 1]], + [[1, 2, -3, 3, 1], [1], [1, 3], [3, 1, 0], []], + ), + ( + "remove-zero-sum-consecutive-nodes-from-linked-list", + [[1, 2, 3, -3, -2]], + [1], + [], + [[1, 2, -2], [1, 2], [2, -2, 1]], + ), + ( + "remove-zero-sum-consecutive-nodes-from-linked-list", + [[2, 5, -5, -2, 2, 7]], + [2, 7], + [], + [[7], [2, 2, 7], [5, 7]], + ), + ( + "restore-the-array-from-adjacent-pairs", + [[[4, -2], [1, 4], [-3, 1]]], + [-2, 4, 1, -3], + [[-3, 1, 4, -2]], + [[-2, 4, 1], [-2, 1, 4, -3], [-2, 4, 1, -3, -2], [4, -2, 1, -3]], + ), + ( + "sort-items-by-groups-respecting-dependencies", + [8, 2, [-1, -1, 1, 0, 0, 1, 0, -1], [[], [6], [5], [6], [3, 6], [], [], []]], + [6, 3, 4, 1, 5, 2, 0, 7], + [[6, 3, 4, 5, 2, 0, 7, 1], [0, 7, 5, 2, 6, 3, 4, 1]], + [[3, 6, 4, 1, 5, 2, 0, 7], [6, 3, 1, 4, 5, 2, 0, 7], [6, 3, 4, 1, 5, 2, 0], [], [6, 3, 4, 1, 5, 2, 0, 0]], + ), + ( + "sort-items-by-groups-respecting-dependencies", + [8, 2, [-1, -1, 1, 0, 0, 1, 0, -1], [[], [6], [5], [6], [3], [], [4], []]], + [], + [], + [[6, 3, 4, 1, 5, 2, 0, 7], [0, 1, 2, 3, 4, 5, 6, 7]], + ), + ( + "the-most-similar-path-in-a-graph", + [ + 5, + [[0, 2], [0, 3], [1, 2], [1, 3], [1, 4], [2, 4]], + ["ATL", "PEK", "LAX", "DXB", "HND"], + ["ATL", "DXB", "HND", "LAX"], + ], + [0, 2, 4, 2], + [[0, 3, 0, 2], [0, 3, 1, 2]], + [[0, 3, 4, 2], [0, 2, 1, 2], [0, 2, 4], [0, 2, 4, 2, 0], [0, 2, 2, 2]], + ), + ( + "valid-arrangement-of-pairs", + [[[1, 3], [3, 2], [2, 1]]], + [[1, 3], [3, 2], [2, 1]], + [[[2, 1], [1, 3], [3, 2]], [[3, 2], [2, 1], [1, 3]]], + [[[1, 3], [2, 1], [3, 2]], [[1, 3], [3, 2]], [[1, 3], [3, 2], [2, 1], [1, 3]], [[1, 3], [3, 1], [1, 2]]], + ), + ( + "smallest-sufficient-team", + [["java", "nodejs", "reactjs"], [["java"], ["nodejs"], ["nodejs", "reactjs"]]], + [0, 2], + [[2, 0]], + [[0, 1, 2], [0, 1], [0, 0], [2, 3], [2]], + ), + ( + "smallest-sufficient-team", + [["a", "b"], [["a"], ["b"], ["a", "b"], ["a", "b"]]], + [2], + [[3]], + [[0, 1], [0], [True]], + ), + ( + "group-the-people-given-the-group-size-they-belong-to", + [[3, 3, 3, 3, 3, 1, 3]], + [[5], [0, 1, 2], [3, 4, 6]], + [[[2, 1, 6], [5], [0, 4, 3]], [[5], [0, 6, 2], [4, 3, 1]]], + [ + [[5], [0, 1, 2], [3, 4]], + [[5], [0, 1, 2, 3], [4, 6]], + [[5], [0, 1, 2], [3, 4, 6], []], + [[5], [0, 1, 2], [3, 4, 4]], + ], + ), +] + + +@pytest.mark.parametrize(("slug", "args", "expected", "others", "invalid"), CASES, ids=[c[0] for c in CASES]) +def test_graph_checkers(slug: str, args: list[Any], expected: Any, others: list[Any], invalid: list[Any]) -> None: + mode = f"checker:{slug}" + assert judge(expected, expected, mode, args) + for answer in others: + assert judge(expected, answer, mode, args), answer + for answer in invalid: + assert not judge(expected, answer, mode, args), answer + + +def test_every_slug_has_a_different_valid_answer() -> None: + slugs = {c[0] for c in CASES} + assert len(slugs) == 14 + assert slugs == {c[0] for c in CASES if c[3]} diff --git a/backend/tests/test_checkers_grids.py b/backend/tests/test_checkers_grids.py new file mode 100644 index 0000000..da5e966 --- /dev/null +++ b/backend/tests/test_checkers_grids.py @@ -0,0 +1,158 @@ +from typing import Any + +import pytest + +from localcode.judging.compare import judge + +# (slug, args, expected, valid answers, invalid answers); the first valid answer is the statement's example. +CASES: list[tuple[str, list[Any], Any, list[Any], list[Any]]] = [ + ( + "build-a-matrix-with-conditions", + [3, [[1, 2], [3, 2]], [[2, 1], [3, 2]]], + [[3, 0, 0], [0, 0, 1], [0, 2, 0]], + [[[3, 0, 0], [0, 0, 1], [0, 2, 0]], [[0, 0, 1], [3, 0, 0], [0, 2, 0]]], + [[[1, 0, 0], [0, 0, 3], [0, 2, 0]], [[3, 0, 0], [0, 0, 1], [0, 1, 0]], [[3, 0, 1], [0, 2, 0]], []], + ), + ( + "build-a-matrix-with-conditions", + [3, [[1, 2], [2, 3], [3, 1], [2, 3]], [[2, 1]]], + [], + [[]], + [[[1, 0, 0], [0, 2, 0], [0, 0, 3]], [[]]], + ), + ( + "color-the-triangle-red", + [3], + [[1, 1], [2, 1], [2, 3], [3, 1], [3, 5]], + [[[1, 1], [2, 1], [2, 3], [3, 1], [3, 5]], [[1, 1], [3, 1], [3, 3], [3, 5], [2, 2]]], + [ + [[1, 1], [2, 1], [2, 3], [3, 1]], + [[1, 1], [2, 1], [2, 2], [2, 3], [3, 3]], + [[1, 1], [2, 1], [2, 3], [3, 1], [3, 6]], + [[1, 1], [1, 1], [2, 3], [3, 1], [3, 5]], + ], + ), + ( + "construct-2d-grid-matching-graph-layout", + [4, [[0, 1], [0, 2], [1, 3], [2, 3]]], + [[3, 1], [2, 0]], + [[[3, 1], [2, 0]], [[0, 1], [2, 3]], [[3, 2], [1, 0]]], + [[[3, 0], [2, 1]], [[3, 1, 0, 2]], [[3, 1], [2, 2]], [[3, 1], [2]]], + ), + ( + "construct-2d-grid-matching-graph-layout", + [5, [[0, 1], [1, 3], [2, 3], [2, 4]]], + [[4, 2, 3, 1, 0]], + [[[4, 2, 3, 1, 0]], [[0], [1], [3], [2], [4]]], + [[[4, 2, 1, 3, 0]], [[4, 2, 3, 1]]], + ), + ( + "convert-an-array-into-a-2d-array-with-conditions", + [[1, 3, 4, 1, 2, 3, 1]], + [[1, 3, 4, 2], [1, 3], [1]], + [[[1, 3, 4, 2], [1, 3], [1]], [[1], [3, 1], [4, 3, 2, 1]]], + [[[1, 3], [4, 2], [1, 3], [1]], [[1, 1, 3, 4], [2, 3], [1]], [[1, 3, 4, 2], [1, 3], [2]]], + ), + ( + "divide-array-into-arrays-with-max-difference", + [[1, 3, 4, 8, 7, 9, 3, 5, 1], 2], + [[1, 1, 3], [3, 4, 5], [7, 8, 9]], + [[[1, 1, 3], [3, 4, 5], [7, 8, 9]], [[9, 7, 8], [3, 1, 1], [5, 4, 3]]], + [[[1, 3, 4], [1, 3, 5], [7, 8, 9]], [[1, 1, 3], [3, 4, 5], [7, 8]], [[1, 1, 3], [3, 4, 5], [7, 8, 8]], []], + ), + ( + "divide-array-into-arrays-with-max-difference", + [[2, 4, 2, 2, 5, 2], 2], + [], + [[]], + [[[2, 2, 2], [2, 4, 5]], [[2, 2, 4], [2, 2, 5]]], + ), + ( + "map-of-highest-peak", + [[[0, 0, 1], [1, 0, 0], [0, 0, 0]]], + [[1, 1, 0], [0, 1, 1], [1, 2, 2]], + [[[1, 1, 0], [0, 1, 1], [1, 2, 2]], [[1, 1, 0], [0, 1, 1], [1, 2, 1]]], + [ + [[1, 1, 0], [0, 1, 1], [1, 1, 1]], + [[1, 1, 1], [0, 1, 1], [1, 2, 2]], + [[1, 1, 0], [0, 1, 1], [1, 3, 2]], + [[1, 1, 0], [0, 1, 1]], + ], + ), + ( + "minimize-maximum-value-in-a-grid", + [[[3, 1], [2, 5]]], + [[2, 1], [1, 2]], + [[[2, 1], [1, 2]]], + [[[2, 1], [1, 3]], [[1, 2], [1, 2]], [[1, 0], [0, 1]]], + ), + ( + "minimize-maximum-value-in-a-grid", + [[[2, 4, 5], [7, 3, 9]]], + [[1, 2, 3], [2, 1, 4]], + [[[1, 2, 3], [2, 1, 4]], [[1, 2, 3], [3, 1, 4]]], + [[[1, 2, 3], [1, 1, 4]], [[1, 2, 3], [2, 1, 5]], [[0, 2, 3], [2, 1, 4]]], + ), + ( + "reconstruct-a-2-row-binary-matrix", + [2, 1, [1, 1, 1]], + [[1, 1, 0], [0, 0, 1]], + [[[1, 1, 0], [0, 0, 1]], [[1, 0, 1], [0, 1, 0]], [[0, 1, 1], [1, 0, 0]]], + [[[1, 1, 1], [0, 0, 0]], [[2, 0, 0], [-1, 1, 1]], [[1, 1, 0], [1, 0, 0]], []], + ), + ( + "reconstruct-a-2-row-binary-matrix", + [2, 3, [2, 2, 1, 1]], + [], + [[]], + [[[1, 1, 0, 0], [1, 1, 1, 1]], [[]]], + ), + ( + "matrix-cells-in-distance-order", + [2, 3, 1, 2], + [[1, 2], [0, 2], [1, 1], [0, 1], [1, 0], [0, 0]], + [[[1, 2], [0, 2], [1, 1], [0, 1], [1, 0], [0, 0]], [[1, 2], [1, 1], [0, 2], [1, 0], [0, 1], [0, 0]]], + [ + [[1, 2], [0, 1], [1, 1], [0, 2], [1, 0], [0, 0]], + [[1, 2], [0, 2], [1, 1], [0, 1], [1, 0]], + [[1, 2], [0, 2], [1, 1], [0, 1], [0, 1], [0, 0]], + [[1, 2], [0, 2], [1, 1], [0, 1], [1, 0], [2, 0]], + ], + ), + ( + "find-a-good-subset-of-the-matrix", + [[[0, 1, 1, 0], [0, 0, 0, 1], [1, 1, 1, 1]]], + [0, 1], + [[0, 1]], + [[1, 0], [0, 1, 2], [], [0, 0, 1]], + ), + ( + "find-a-good-subset-of-the-matrix", + [[[0, 0, 0], [0, 1, 0], [1, 0, 0]]], + [0], + [[0], [1, 2], [0, 1, 2]], + [[1], [2, 1], [3]], + ), + ( + "find-a-good-subset-of-the-matrix", + [[[1, 1, 1], [1, 1, 1]]], + [], + [[]], + [[0], [0, 1]], + ), +] + + +@pytest.mark.parametrize(("slug", "args", "expected", "valid", "invalid"), CASES) +def test_checker(slug: str, args: list[Any], expected: Any, valid: list[Any], invalid: list[Any]) -> None: + mode = f"checker:{slug}" + for answer in valid: + assert judge(expected, answer, mode, args), answer + for answer in invalid: + assert not judge(expected, answer, mode, args), answer + + +def test_every_slug_has_a_different_valid_answer() -> None: + slugs = {case[0] for case in CASES} + with_alternative = {slug for slug, *_, valid, _ in CASES if len(valid) > 1} + assert slugs == with_alternative diff --git a/backend/tests/test_checkers_numbers.py b/backend/tests/test_checkers_numbers.py new file mode 100644 index 0000000..21e5d12 --- /dev/null +++ b/backend/tests/test_checkers_numbers.py @@ -0,0 +1,143 @@ +from typing import Any + +from localcode.judging.compare import judge + + +def ok(slug: str, args: list[Any], expected: Any, actual: Any) -> bool: + return judge(expected, actual, f"checker:{slug}", args) + + +def test_beautiful_arrangement_ii(): + slug, args, expected = "beautiful-arrangement-ii", [3, 2], [1, 3, 2] + assert ok(slug, args, expected, [1, 3, 2]) + assert ok(slug, args, expected, [2, 3, 1]) + assert not ok(slug, args, expected, [1, 2, 3]) + assert not ok(slug, args, expected, [1, 3]) + assert not ok(slug, args, expected, [1, 3, 3]) + assert not ok(slug, args, expected, [1, 4, 2]) + + +def test_beautiful_array(): + slug, args, expected = "beautiful-array", [4], [2, 1, 4, 3] + assert ok(slug, args, expected, [2, 1, 4, 3]) + assert ok(slug, args, expected, [1, 3, 2, 4]) + assert not ok(slug, args, expected, [1, 2, 3, 4]) + assert not ok(slug, args, expected, [2, 1, 4]) + assert not ok(slug, args, expected, [2, 1, 4, 4]) + assert ok(slug, [5], [3, 1, 2, 5, 4], [3, 1, 2, 5, 4]) + + +def test_circular_permutation_in_binary_representation(): + slug, args, expected = "circular-permutation-in-binary-representation", [2, 3], [3, 2, 0, 1] + assert ok(slug, args, expected, [3, 2, 0, 1]) + assert ok(slug, args, expected, [3, 1, 0, 2]) + assert not ok(slug, args, expected, [2, 3, 1, 0]) + assert not ok(slug, args, expected, [3, 0, 1, 2]) + assert not ok(slug, args, expected, [3, 2, 0]) + assert ok(slug, [3, 2], [2, 6, 7, 5, 4, 0, 1, 3], [2, 6, 7, 5, 4, 0, 1, 3]) + + +def test_convert_integer_to_the_sum_of_two_no_zero_integers(): + slug, args, expected = "convert-integer-to-the-sum-of-two-no-zero-integers", [11], [2, 9] + assert ok(slug, args, expected, [2, 9]) + assert ok(slug, args, expected, [8, 3]) + assert not ok(slug, args, expected, [1, 10]) + assert not ok(slug, args, expected, [5, 5]) + assert not ok(slug, args, expected, [11, 0]) + assert not ok(slug, args, expected, [2, 9, 0]) + + +def test_di_string_match(): + slug, args, expected = "di-string-match", ["IDID"], [0, 4, 1, 3, 2] + assert ok(slug, args, expected, [0, 4, 1, 3, 2]) + assert ok(slug, args, expected, [1, 3, 0, 4, 2]) + assert not ok(slug, args, expected, [0, 1, 2, 3, 4]) + assert not ok(slug, args, expected, [0, 4, 1, 3]) + assert not ok(slug, args, expected, [0, 5, 1, 3, 2]) + + +def test_find_array_given_subset_sums(): + slug, args, expected = "find-array-given-subset-sums", [3, [-3, -2, -1, 0, 0, 1, 2, 3]], [1, 2, -3] + assert ok(slug, args, expected, [1, 2, -3]) + assert ok(slug, args, expected, [-1, -2, 3]) + assert ok(slug, args, expected, [-3, 2, 1]) + assert not ok(slug, args, expected, [1, 2, 3]) + assert not ok(slug, args, expected, [1, 2]) + assert not ok(slug, args, expected, [1, 2, -3, 0]) + assert ok(slug, [2, [0, 0, 0, 0]], [0, 0], [0, 0]) + + +def test_find_missing_observations(): + slug, args, expected = "find-missing-observations", [[1, 5, 6], 3, 4], [2, 3, 2, 2] + assert ok(slug, args, expected, [2, 3, 2, 2]) + assert ok(slug, args, expected, [5, 2, 1, 1]) + assert not ok(slug, args, expected, [2, 3, 2, 3]) + assert not ok(slug, args, expected, [7, 1, 1, 0]) + assert not ok(slug, args, expected, [4, 4]) + assert ok(slug, [[1, 2, 3, 4], 6, 4], [], []) + assert not ok(slug, [[1, 2, 3, 4], 6, 4], [], [6, 6, 6, 6]) + + +def test_find_n_unique_integers_sum_up_to_zero(): + slug, args, expected = "find-n-unique-integers-sum-up-to-zero", [5], [-7, -1, 1, 3, 4] + assert ok(slug, args, expected, [-7, -1, 1, 3, 4]) + assert ok(slug, args, expected, [-3, -1, 2, -2, 4]) + assert not ok(slug, args, expected, [0, 0, 0, 0, 0]) + assert not ok(slug, args, expected, [-1, 0, 1]) + assert not ok(slug, args, expected, [1, 2, 3, 4, 5]) + + +def test_gray_code(): + slug, args, expected = "gray-code", [2], [0, 1, 3, 2] + assert ok(slug, args, expected, [0, 1, 3, 2]) + assert ok(slug, args, expected, [0, 2, 3, 1]) + assert not ok(slug, args, expected, [1, 0, 2, 3]) + assert not ok(slug, args, expected, [0, 3, 1, 2]) + assert not ok(slug, args, expected, [0, 1, 3]) + assert not ok(slug, args, expected, [0, 1, 3, 2, 0]) + + +def test_largest_divisible_subset(): + slug, args, expected = "largest-divisible-subset", [[1, 2, 3]], [1, 2] + assert ok(slug, args, expected, [1, 2]) + assert ok(slug, args, expected, [3, 1]) + assert not ok(slug, args, expected, [2, 3]) + assert not ok(slug, args, expected, [1]) + assert not ok(slug, args, expected, [1, 1]) + assert not ok(slug, args, expected, [1, 4]) + assert ok(slug, [[1, 2, 4, 8]], [1, 2, 4, 8], [8, 4, 2, 1]) + + +def test_maximum_points_in_an_archery_competition(): + slug = "maximum-points-in-an-archery-competition" + args, expected = [9, [1, 1, 0, 1, 0, 0, 2, 1, 0, 1, 2, 0]], [0, 0, 0, 0, 1, 1, 0, 0, 1, 2, 3, 1] + assert ok(slug, args, expected, expected) + args, expected = [5, [0, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2] + assert ok(slug, args, expected, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2]) + assert not ok(slug, args, expected, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2]) + assert not ok(slug, args, expected, [0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2]) + assert not ok(slug, args, expected, [1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2]) + assert not ok(slug, args, expected, [3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, -2]) + + +def test_recover_the_original_array(): + slug, args, expected = "recover-the-original-array", [[2, 10, 6, 4, 8, 12]], [3, 7, 11] + assert ok(slug, args, expected, [3, 7, 11]) + assert ok(slug, args, expected, [9, 5, 7]) + assert not ok(slug, args, expected, [3, 7]) + assert not ok(slug, args, expected, [4, 8, 12]) + assert not ok(slug, args, expected, [3, 7, 11, 7]) + assert ok(slug, [[1, 1, 3, 3]], [2, 2], [2, 2]) + assert not ok(slug, [[1, 1, 3, 3]], [2, 2], [1, 3]) + + +def test_split_array_into_fibonacci_sequence(): + slug, args, expected = "split-array-into-fibonacci-sequence", ["1101111"], [11, 0, 11, 11] + assert ok(slug, args, expected, [11, 0, 11, 11]) + assert ok(slug, args, expected, [110, 1, 111]) + assert not ok(slug, args, expected, [1, 10, 11, 11]) + assert not ok(slug, args, expected, [11, 0, 11]) + assert not ok(slug, args, expected, []) + assert ok(slug, ["112358130"], [], []) + assert not ok(slug, ["112358130"], [], [1, 1, 2, 3, 5, 8, 13]) + assert not ok(slug, ["0123"], [], [0, 1, 23]) diff --git a/backend/tests/test_checkers_strings.py b/backend/tests/test_checkers_strings.py new file mode 100644 index 0000000..930e803 --- /dev/null +++ b/backend/tests/test_checkers_strings.py @@ -0,0 +1,147 @@ +from typing import Any + +import pytest + +from localcode.judging.compare import judge + +# slug -> (args, statement's example answer, other valid answers, invalid answers) +CASES: dict[str, tuple[list[Any], Any, list[Any], list[Any]]] = { + "custom-sort-string": ( + ["cba", "abcd"], + "cbad", + ["dcba", "cdba", "cbda"], + ["abcd", "cbaa", "cba", "cbade", ["c", "b", "a", "d"]], + ), + "find-unique-binary-string": ( + [["111", "011", "001"]], + "101", + ["000", "010", "100", "110"], + ["111", "10", "1010", "1a1", 101], + ), + "generate-a-string-with-characters-that-have-odd-counts": ( + [4], + "pppz", + ["ohhh", "love", "abcd"], + ["ppzz", "ppp", "pppZ", "ppp1", "ppppz"], + ), + "longest-happy-string": ( + [1, 1, 7], + "ccaccbcc", + ["ccbccacc"], + ["cccaccbc", "ccaccbc", "ccaccacc", "ccdccbcc", "ccaccbccc"], + ), + "minimum-remove-to-make-valid-parentheses": ( + ["lee(t(c)o)de)"], + "lee(t(c)o)de", + ["lee(t(co)de)", "lee(t(c)ode)"], + ["lee(t(c)o)d)", "le(t(c)o)de", "lee(t(c)o)de)", "lee(t(c)o)ed", "let(c)o)de", "lee(tc)o)de"], + ), + "reorganize-string": ( + ["aab"], + "aba", + [], + ["aab", "ab", "abb", ""], + ), + "replace-all-s-to-avoid-consecutive-repeating-characters": ( + ["ubv?w"], + "ubvaw", + ["ubvbw", "ubvzw"], + ["ubvvw", "ubvww", "ubv?w", "ubvAw", "ubva", "abvaw"], + ), + "sort-characters-by-frequency": ( + ["tree"], + "eert", + ["eetr"], + ["tree", "eret", "reet", "eer", "eertt"], + ), + "string-without-aaa-or-bbb": ( + [1, 2], + "abb", + ["bab", "bba"], + ["aab", "ab", "abbb", "abc", "bbb"], + ), + "longest-duplicate-substring": ( + ["banana"], + "ana", + [], + ["an", "nan", "ban", "anan", ""], + ), + "longest-unequal-adjacent-groups-subsequence-i": ( + [["e", "a", "b"], [0, 0, 1]], + ["e", "b"], + [["a", "b"]], + [["e", "a"], ["b", "e"], ["e"], ["e", "x"], ["e", "a", "b"]], + ), + "longest-unequal-adjacent-groups-subsequence-ii": ( + [["bab", "dab", "cab"], [1, 2, 2]], + ["bab", "cab"], + [["bab", "dab"]], + [["dab", "cab"], ["cab", "bab"], ["bab"], ["bab", "dab", "cab"], ["bab", "xab"]], + ), +} + +# Problems whose example answer has no alternative in the statement get extra cases with several answers. +EXTRA: list[tuple[str, list[Any], Any, list[Any], list[Any]]] = [ + ("reorganize-string", ["aabbc"], "ababc", ["abcab", "cabab", "babac"], ["aabbc", "ababb", "abab"]), + ("reorganize-string", ["aaab"], "", [], ["abaa", "aaba", "aaab"]), + ("longest-duplicate-substring", ["abcabxab"], "ab", [], ["bc", "ca", "a", "abc"]), + ("longest-duplicate-substring", ["abcabcxbca"], "abc", ["bca"], ["cab", "abca", "ab"]), + ("longest-duplicate-substring", ["abcd"], "", [], ["a", "ab", "abcd"]), + ("longest-duplicate-substring", ["aaaa"], "aaa", [], ["aa", "aaaa", "aab"]), + ("longest-happy-string", [7, 1, 0], "aabaa", [], ["aaba", "abaab", "aabaaa", "aabba"]), + ("longest-happy-string", [0, 0, 1], "c", [], ["", "a", "cc"]), + ("minimum-remove-to-make-valid-parentheses", ["))(("], "", [], ["()", ")(", "("]), + ( + "longest-unequal-adjacent-groups-subsequence-i", + [["a", "b", "c", "d"], [1, 0, 1, 1]], + ["a", "b", "c"], + [["a", "b", "d"]], + [["a", "c", "d"], ["b", "c", "d"], ["a", "b"]], + ), + ( + "longest-unequal-adjacent-groups-subsequence-ii", + [["a", "b", "c", "d"], [1, 2, 3, 4]], + ["a", "b", "c", "d"], + [], + [["a", "b", "c"], ["a", "c", "b", "d"]], + ), + ( + "longest-unequal-adjacent-groups-subsequence-ii", + [["ab", "ac", "bc", "abc"], [1, 2, 1, 2]], + ["ab", "ac", "bc"], + [], + [["ab", "ac", "abc"], ["ab", "bc", "ac"], ["ab", "ac"]], + ), +] + +ALL = [(slug, *case) for slug, case in CASES.items()] + EXTRA + + +def test_every_slug_has_a_different_valid_answer() -> None: + covered = {slug for slug, _, _, others, _ in ALL if others} + assert covered == set(CASES) + + +def test_every_slug_rejects_invalid_answers() -> None: + for slug in CASES: + assert sum(len(bad) for s, _, _, _, bad in ALL if s == slug) >= 2 + + +@pytest.mark.parametrize(("slug", "args", "example", "others", "invalid"), ALL) +def test_accepts_valid_answers(slug: str, args: list[Any], example: Any, others: list[Any], invalid: list[Any]) -> None: + for answer in [example, *others]: + assert judge(example, answer, f"checker:{slug}", args), answer + + +@pytest.mark.parametrize(("slug", "args", "example", "others", "invalid"), ALL) +def test_rejects_invalid_answers( + slug: str, args: list[Any], example: Any, others: list[Any], invalid: list[Any] +) -> None: + for answer in invalid: + assert not judge(example, answer, f"checker:{slug}", args), answer + + +def test_long_duplicate_substring_input_is_fast() -> None: + s = "ab" * 50_000 + assert judge(s[:-2], s[2:], "checker:longest-duplicate-substring", [s]) + assert not judge(s[:-1], "a" * (len(s) - 1), "checker:longest-duplicate-substring", [s]) diff --git a/backend/tests/test_compare.py b/backend/tests/test_compare.py index 1625c0b..7d7c917 100644 --- a/backend/tests/test_compare.py +++ b/backend/tests/test_compare.py @@ -35,3 +35,51 @@ def test_none_vs_empty(): def test_strings(): assert judge("abc", "abc") assert not judge("abc", "abd") + + +def test_any_order_deep_ignores_order_at_every_level(): + assert judge([[1, 2], [3, 4]], [[4, 3], [2, 1]], "any_order_deep") + assert judge([["eat", "tea"], ["bat"]], [["bat"], ["tea", "eat"]], "any_order_deep") + + +def test_any_order_deep_still_checks_contents(): + assert not judge([[1, 2], [3, 4]], [[1, 2], [3, 5]], "any_order_deep") + assert not judge([[1, 2], [3]], [[1, 2, 3]], "any_order_deep") + assert not judge([[1, 1], [2]], [[1], [1, 2]], "any_order_deep") + + +def test_each_any_order_keeps_slots_but_not_their_contents(): + assert judge([[3, 7], [8, 9, 101]], [[7, 3], [101, 8, 9]], "each_any_order") + assert not judge([[3, 7], [8, 9, 101]], [[8, 9, 101], [3, 7]], "each_any_order") + + +def test_checker_mode_validates_against_the_inputs(): + from localcode.judging import checkers + + checkers.CHECKERS["test-pair-sum"] = lambda args, expected, actual: sum(args[0][i] for i in actual) == args[1] + try: + assert judge([0, 1], [2, 3], "checker:test-pair-sum", args=[[1, 2, 3, 4], 7]) + assert not judge([0, 1], [0, 1], "checker:test-pair-sum", args=[[1, 2, 3, 4], 7]) + finally: + del checkers.CHECKERS["test-pair-sum"] + + +def test_checker_that_raises_rejects_the_answer(): + from localcode.judging import checkers + + checkers.CHECKERS["test-raises"] = lambda args, expected, actual: actual[99] > 0 + try: + assert not judge([1], [1], "checker:test-raises", args=[]) + finally: + del checkers.CHECKERS["test-raises"] + + +def test_unknown_checker_falls_back_to_exact(): + assert judge([1, 2], [1, 2], "checker:no-such-problem", args=[]) + assert not judge([1, 2], [2, 1], "checker:no-such-problem", args=[]) + + +def test_any_order_keeps_float_tolerance(): + assert judge([3.0, 25.0], [25.0, 2.9999999999999996], "any_order") + assert judge([[0.1, 2.0]], [[1.9999999, 0.1]], "any_order_deep") + assert not judge([3.0, 25.0], [25.0, 3.1], "any_order") diff --git a/backend/tests/test_validate_cases.py b/backend/tests/test_validate_cases.py index 0c9c0d8..5a44f35 100644 --- a/backend/tests/test_validate_cases.py +++ b/backend/tests/test_validate_cases.py @@ -1,17 +1,153 @@ from localcode.tools.validate_cases import cases_to_exclude -def test_excludes_cases_every_trusted_reference_fails(): - outcomes = {"java": [True, False, True, True], "cpp": [True, False, False, True]} - assert cases_to_exclude(outcomes) == {1} +def passing_all_but(n: int, *failing: int) -> list[bool]: + return [i not in failing for i in range(n)] -def test_ignores_references_that_mostly_fail(): - # cpp's reference fails most cases (wrong signature semantics), so only java is trusted - outcomes = {"java": [True, True, False, True], "cpp": [False, False, False, True]} +def test_a_confident_reference_excludes_on_its_own(): + # A correct typed solution can fail an invalid case in one language while another gets lucky + # (C++ often reads out of bounds without crashing), so one confident failure is enough. + outcomes = {"java": passing_all_but(10, 2), "cpp": passing_all_but(10, 5)} + assert cases_to_exclude(outcomes) == {2, 5} + + +def test_less_confident_references_must_agree(): + # Each passes 80%: on its own that could be a buggy reference, so only shared failures count. + outcomes = {"java": passing_all_but(10, 1, 2), "cpp": passing_all_but(10, 2, 3)} assert cases_to_exclude(outcomes) == {2} -def test_no_trusted_reference_excludes_nothing(): +def test_a_single_trusted_reference_still_decides(): + # Suites with many invalid cases leave the only reference below the confident bar. + assert cases_to_exclude({"java": passing_all_but(10, 1, 2)}) == {1, 2} + + +def test_confident_and_less_confident_references_combine(): + outcomes = {"java": passing_all_but(10, 3), "cpp": passing_all_but(10, 0, 1, 2, 4, 6)} + assert cases_to_exclude(outcomes) == {3} + + +def test_untrusted_references_are_ignored(): + outcomes = {"java": passing_all_but(10, 4), "cpp": passing_all_but(10, *range(6))} + assert cases_to_exclude(outcomes) == {4} assert cases_to_exclude({"java": [False, False, True]}) == set() assert cases_to_exclude({}) == set() + + +def test_order_only_differences_are_flagged(): + from localcode.tools.validate_cases import differs_only_in_order + + assert differs_only_in_order([[-1, 0, 1], [-1, -1, 2]], [[-1, -1, 2], [0, -1, 1]], "exact", []) + assert not differs_only_in_order([[1, 2]], [[1, 2]], "exact", []) # not a failure at all + assert not differs_only_in_order([[1, 2]], [[1, 3]], "exact", []) # a real difference + assert not differs_only_in_order([[1, 2], [3]], [[2, 1], [3]], "any_order_deep", []) + + +def test_from_sources_builds_an_unfiltered_database(tmp_path, monkeypatch): + import json + import shutil + import sqlite3 + from pathlib import Path + + from localcode import db + from localcode.tools.validate_cases import prepare_from_sources + + fix = Path(__file__).parent / "fixtures" + src = tmp_path / "sources" + (src / "dataset").mkdir(parents=True) + shutil.copy(fix / "dataset_rows.jsonl", src / "dataset" / "LeetCodeDataset-train.jsonl") + shutil.copytree(fix / "doocs", src / "doocs") + monkeypatch.setattr(db, "CONTENT_DB", tmp_path / "unused.db") + monkeypatch.setattr(db, "USER_DB", tmp_path / "unused-user.db") + monkeypatch.setattr("localcode.importer.build.load_excluded", lambda: {"pair-sum": {"anything"}}) + + work = tmp_path / "work" + prepare_from_sources(src, work) + prepare_from_sources(src, work) # rebuilds from scratch rather than carrying the old database forward + + assert (work / "content.db", work / "user.db") == (db.CONTENT_DB, db.USER_DB) + con = sqlite3.connect(db.CONTENT_DB) + cases = con.execute("select cases from tests where slug = 'pair-sum'").fetchone()[0] + assert len(json.loads(cases)) == 4 + + +def test_checker_rejections_are_never_order_only(monkeypatch): + from localcode.judging import checkers + from localcode.tools.validate_cases import differs_only_in_order + + # On an invalid input the reference repeats the recorded (invalid) answer; the checker rejects it. + monkeypatch.setitem(checkers.CHECKERS, "test-strict", lambda args, expected, actual: False) + assert not differs_only_in_order([1, 2], [1, 2], "checker:test-strict", []) + assert not differs_only_in_order([1, 2], [2, 1], "checker:test-strict", []) + + +def test_order_only_cases_are_reported_but_still_fail(monkeypatch): + from localcode.judging import runner_client + from localcode.tools import validate_cases + + values = [[[1, 2]], [[2, 1]], [[9]]] + monkeypatch.setattr( + runner_client, + "execute", + lambda req, url=None: {"compile_error": None, "results": [{"ok": True, "value": v} for v in values]}, + ) + problem = {"method": "f", "params": "[]", "ret": "List[List[int]]", "compare_mode": "exact"} + cases = [{"args": [i], "expected": [[1, 2]]} for i in range(3)] + ok, order_only = validate_cases._outcomes(problem, "java", "code", cases, None, "unix:test") + assert ok == [True, False, False] + assert order_only == [False, True, False] + + +def test_references_failing_exactly_the_same_cases_exclude_them_even_when_most_fail(): + # Mostly-invalid suites (inputs that break the constraints) leave every reference below the + # trusted bar; two references agreeing case for case is still strong evidence. + failing = set(range(6)) + outcomes = {"java": passing_all_but(10, *failing), "cpp": passing_all_but(10, *failing)} + assert cases_to_exclude(outcomes) == failing + + +def test_agreement_needs_two_references_and_three_surviving_cases(): + assert cases_to_exclude({"java": passing_all_but(10, *range(6))}) == set() + both = passing_all_but(10, *range(8)) + assert cases_to_exclude({"java": both, "cpp": list(both)}) == set() + disagree = {"java": passing_all_but(10, *range(6)), "cpp": passing_all_but(10, *range(1, 8))} + assert cases_to_exclude(disagree) == set() + + +def test_fresh_run_ignores_previous_output(tmp_path, monkeypatch): + import json + + from localcode.tools import validate_cases + + out = tmp_path / "excluded.json" + out.write_text('{"stale-problem": ["abc"]}') + out.with_suffix(".order.json").write_text('{"stale-problem": 3}') + monkeypatch.setattr(validate_cases, "_runnable_slugs", lambda: ["pair-sum"]) + monkeypatch.setattr(validate_cases, "_validate_one", lambda slug, url: (["k1"], {"java": "3/4"}, 0, True)) + monkeypatch.setattr(validate_cases.runner_client, "endpoints", lambda: ["unix:test"]) + + assert validate_cases.validate(out, fresh=True) == {"pair-sum": ["k1"]} + assert json.loads(out.with_suffix(".order.json").read_text()) == {} + assert json.loads(out.with_suffix(".review.json").read_text()) == {"pair-sum": [1, 4]} + out.write_text('{"kept": []}') + assert validate_cases.validate(out) == {"kept": [], "pair-sum": ["k1"]} + + +def test_exclusions_without_a_trusted_reference_need_review(): + from localcode.tools.validate_cases import needs_review + + most_fail = {"java": passing_all_but(10, *range(6)), "cpp": passing_all_but(10, *range(6))} + assert needs_review(most_fail) + assert not needs_review({"java": passing_all_but(10, 1), "cpp": passing_all_but(10, 1)}) + assert not needs_review({"java": passing_all_but(10, *range(8))}) # nothing excluded + + +def test_cases_whose_own_answer_fails_the_checker_are_unjudgeable(monkeypatch): + from localcode.judging import checkers + from localcode.tools.validate_cases import unjudgeable_cases + + monkeypatch.setitem(checkers.CHECKERS, "test-even", lambda args, expected, actual: actual % 2 == 0) + cases = [{"args": [1], "expected": 2}, {"args": [2], "expected": 3}, {"args": [3], "expected": 4}] + assert unjudgeable_cases(cases, "checker:test-even") == {1} + assert unjudgeable_cases(cases, "exact") == set() diff --git a/backend/tests/test_verdicts.py b/backend/tests/test_verdicts.py index 009508a..ab13ef1 100644 --- a/backend/tests/test_verdicts.py +++ b/backend/tests/test_verdicts.py @@ -52,3 +52,22 @@ def test_run_timeout_marks_missing_cases(): g = grade_run([[1], [2]], [1, 2], res([1], timed_out=True), "exact") assert g.verdict == "Time Limit Exceeded" assert g.cases[1].ok is False + + +def _register_double_checker(monkeypatch): + from localcode.judging import checkers + + monkeypatch.setitem(checkers.CHECKERS, "test-double", lambda args, expected, actual: actual == args[0] * 2) + + +def test_submission_passes_inputs_to_checkers(monkeypatch): + _register_double_checker(monkeypatch) + cases = [{"args": [n], "expected": -1} for n in (1, 2, 3)] + assert grade_submission(cases, res([2, 4, 6]), "checker:test-double").verdict == "Accepted" + assert grade_submission(cases, res([2, 5, 6]), "checker:test-double").verdict == "Wrong Answer" + + +def test_run_passes_inputs_to_checkers(monkeypatch): + _register_double_checker(monkeypatch) + g = grade_run([[1], [2]], [-1, -1], res([2, 3]), "checker:test-double") + assert [c.ok for c in g.cases] == [True, False] diff --git a/content/README.md b/content/README.md index d904a44..a9a9cb3 100644 --- a/content/README.md +++ b/content/README.md @@ -28,7 +28,7 @@ title: Longest Vowel Run difficulty: Easy # Easy, Medium or Hard tags: [String] # topics, as shown in the filter list id: 9001 # optional problem number; leave it out for new problems -compare: exact # optional: exact (default) or any_order +compare: exact # optional: exact (default), any_order, any_order_deep or each_any_order --- The statement, in Markdown. Use $...$ for math. ``` diff --git a/docs/architecture.md b/docs/architecture.md index 043f7ac..37d0232 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -47,7 +47,7 @@ Every runnable problem stores: - `ret`: the abstract return type. - `cases`: `[{args: [...], expected: ...}]` as JSON. Linked lists and trees use LeetCode's array and level-order forms. A null node result is `[]`. - `examples`: argument lists parsed from the statement, used by Run. -- `compare_mode`: `exact`, or `any_order` when the statement says "in any order". +- `compare_mode`: how an answer is judged (`localcode/judging/compare.py`): `exact`; `any_order` when the statement says "in any order"; `any_order_deep` or `each_any_order` for nested answers (curated in `judging/answer_modes.py`); or `checker:`, a per-problem function in `judging/checkers/` that validates the answer against the inputs, for problems that accept several valid answers. Run computes expected values by executing the dataset's Python reference solution. They're cached per input, keyed by the content version, so a re-import invalidates them. diff --git a/runner/languages.py b/runner/languages.py index 161c31e..9313776 100644 --- a/runner/languages.py +++ b/runner/languages.py @@ -16,7 +16,7 @@ # Implicit imports share the user's first line so reported line numbers match the editor. JAVA_IMPORTS = ( "import java.util.*; import java.util.function.*; import java.util.stream.*; import java.math.*; " - "import javafx.util.Pair; " + "import java.text.*; import javafx.util.Pair; " ) KOTLIN_IMPORTS = "import java.util.*; import kotlin.math.*; " JVM_CLASSPATH = ".:/opt/lib/gson.jar:/opt/lib/driver.jar" diff --git a/runner/tests/test_jvm.py b/runner/tests/test_jvm.py index f140994..2e244d2 100644 --- a/runner/tests/test_jvm.py +++ b/runner/tests/test_jvm.py @@ -187,3 +187,16 @@ def test_java_null_for_primitive_is_a_clear_error(run): ) assert r["results"][0]["ok"] is False assert "null is not a valid int" in r["results"][0]["error"] + + +def test_java_text_is_available_without_import(run): + code = ( + "class Solution {\n" + " public String fmt(double x) {\n" + ' return new DecimalFormat("#0.000").format(x);\n' + " }\n" + "}\n" + ) + r = run("java", code, "fmt", [{"name": "x", "type": "float"}], [[1.5]]) + assert r["compile_error"] is None, r + assert r["results"][0]["value"] == "1.500"