Upload folder using huggingface_hub (#1)
Browse files- b1f9da41fac45ebab8a866ace7212130adfa968ea7ec66aa049bed8332b6455b (0e6ab97c793efa5427bd364df35732dbd5b084b5)
- 39a8ae557bafed1b5e5736c10b5897d38635ffc981d13fa842f1ce72e4046229 (f6ac8cb84924472aa350940691a602b2c9fa5d77)
- aa9f16787efe708ad3a07abcb7b77b12da828574e5773d4600a267c509cc6641 (9f3adc3e3ffb3cd8bf239fbac106c16d3281a224)
- 01f8c30643da4e616b39828bdd070cc9851cf24934ec52fcd98787d2c1446c33 (d35a1f6be5ae724b54658d87d78a0fe5b779588f)
- 14ab409edfef4a81fc639f38f617cb57b2898858fdb8b5c7793caef802ef3116 (2be5fb2a509981079573a1e4b27df7d97d5ffce0)
- 353c15902798457bfcfe773894f1f96829c77e28e06534d5893bcd1bf0591cb1 (e0824424f2b1ebba848ac753f4f0abed5c1c9e12)
- d01b35c5439261f08011d6fb1004bf5de26e932d5d4318d528035d5a82f46ffa (a53a3f92b38a110c318cec8677cadafb0d660a41)
- 9d278973e453cde681bddd7e6d18cf26ffaf0f9dcf031dd782900e43f3236f28 (ace9da1b5f2e055fb22068210bd98e5dce1a113c)
- cf801ce923240012fcdf362d277c93169e502580d006b424fe732e7547d7e77e (63cf3bb024699ced8ff28dfb0ad1f459f39ba4c6)
- f7d2bc3d9c9de3eb48f5a72335a4087e03fb4617f3c5ace04dcbcf0adcdb98c9 (c1074a7d4b265454810ed4f2b1f52e5d6e85f165)
- 7788aa3ea955f332d5b6cc7dd82d2ac7c59291971a8306f1ddc7300bf433d20f (f65a5b6c10a355147eb4a4b60cef636ab47bc6cf)
- a54d0744d3adeb64425139b993c3f0457b61ebc81d16aa5c021673f8c7973711 (b629ff67a075e67a5412677e3a3c5c8e651b6292)
- 28e253573a301e90b33ecaa8d9fa477bbb3ae9775c74dfd0144d375ddcc69e5f (540c128b2c6a364a73019da9cd1a7305edd7c7a6)
- d626876cf072af0b6013a204ca3af7b22fd6e14b0b49e196df4e4b44ef5e012d (4b2a0a085694df263b5edbf07c6e51e99fb0c303)
- df6fb70d49cdd32f373a6c52c198425ff3472d69b05820480ef7d79a6861e68f (d52182c74f7803ca0e4cf52404ec3e59d4ca94f2)
- 7120b0e378bb716bf1a5dff04491c44220f217e0aa5932e56a6de063a41aa084 (45d13632373d8e9f47aafda91d1df756cf2ae25f)
- 6aaf4ecffe98c75cec67053fd2414676b5b50d0f7ae22166b1300dacef6dec28 (4435dcad2c0be75f20f091874404c1c2fed8d96b)
- 2bdb3feecad6227632f0a134e313f3dcd67eb28c9615e0dac64375f537b1777e (13582ae84623a785e7e8d020f88a645f6e5b9b66)
- 3ed573650f14744b4664283a80b6909de8ec62818885e86cc43375fef9fb4529 (99c27a8735449db3ee82200b7a8396edffd954d0)
- 98518f6232b8c97162c9e2cf01e2d99952b5e61ffddb28be94c91646ab5c88f1 (cda9306c097d0619d90b7211b165221c0bfcfefa)
- 931860a9a1d95a21cf69aee18b8bd2cdf0af4907340b1a2808019fdac081e71f (198b7b24bbad80c84b8cfa9ebaada5f3f43b51e7)
- 7b7f3927df79d4d2c8ddcafeca2454d630848762383516f5f1d449d76bbb4d37 (bc331f9b7e91bf0c75eb3c3529f29a5705c37058)
- 52ffdb76285d91b56181b3df3261204b6c7d380857e42d4e219cd5a137f09866 (c2dc5100fa6134ec1ccbe0af50af6950c5b8a4b7)
- ee452106bc66ffde5b4391befe7f259d47f441ce3015a7d82acdbea3da50b6ec (a30be0396f137a9f12082223e76687fafaf41e43)
- ee6dde840dcc10881743f1bf0b2a5f4bcb7e3d5bb1904794b22863e0226926d3 (00d8e400e7f7ef7f21d734f39dc9213e8abc74be)
- 92988b1e4e7745ed81cac53dcd42a92de49fde9a78668977a27ff3a15c81c91a (6bad75bd4f2988ab47ccd0fde6bfd026997bf9d5)
- 2dc0f28d5f527335410d74b76fd7b2b0b98971f50a2870d6872a805213a9af25 (796c546980216d4c0715f89da2b97708e9438089)
- 50a19bd61a8e7d30d85ac2c2db11e620c1d1b94f685189f815467ae2019aa291 (621c2ebedcd7db888ae8730c9f1ff5597c31920a)
- 01a35ba565c422ec36f98a97d382fe7678d18342875849716a4de188c10fda52 (5b97c3770b3d277e423cf282246ecf871f3eb879)
- 602dcbb54a71f59d3651f8d95f65c2bd4e0c21cd33611bb84f618486360a41b0 (7a831d847c60101f3a045dfaaaab7b7d8148c1a2)
- 34ae1e5a7f8612fc25f5e2e83a5971f3540b6dc3bedf0dc25d7c1eb5a8215163 (5964563c84b9002cca7ce23f848c0f56bae3d6fa)
- 35196a8d623a29fd9d0888b07d48d576846cf1a68fff0b2b570d1f3187eec310 (d51917b81377f7fcd692d50283decb75413329a1)
- 75b226d491c5cfd0cb0576f9fbda1a33b06cbc80a09ef580568008fe60ff15ba (923c7903b1074e3c7e4122c9edbb4aadb9f35d12)
- 87988a2e0843c28eb891b6405463ff6582bf7d06d05ae8dce71469edfdee8a98 (38d82074852bdd08dcb097077405d2356f202f4e)
- 03ab2ccbb3c596f4b569ea29a1708c2f35c9615f61d50e8706d35be5ad7589e2 (2508fb274d7e67460521266dd88811ebf86f0230)
- 0ffe00eb80825987deb6309da960a8a9552940ddfc60de62fc1020028fb2c4ab (bf3bec34ffabd1f51648f7a982365c8d04b98719)
- 6eee26792c406aadb14f1a9f1a5570568fbd757659dfa2a1a89f4f1d3a5318b2 (a1f68ed7b6ae487da04736982748ca11e16230db)
- 89faea376bbae1bbc08075e7ee258df9dca329683f3b7ec070d414da7b5e4867 (21bef0d5d014fae6b4d25c7680537dafd3cdf893)
- 39540dc111a52de652e67196dfbc20970f9019caec53ad906dd02e94ff244fc2 (1e6908c5500e3c822f19b316a14bce0e6f4e338e)
- 7260b1a7e5f9ee987460047d0344a7f8745c5a35488691f344f81d40f6088db5 (5bf07651fd528774cd69caa5b39e470ce5a7ced4)
- 605caf3f91256bf157721222a7e30a5041f4a4cae4b7f4677de012105522d744 (7bb84d802c03d643da2b095ae5a68830a059c812)
- 50b2b52effdde3c2d67824682117ae3e467dd7ac5bf4c97ff29f4961603558e1 (885b1d8fc64133db9c0890b719c6a4892da7eb8f)
- da0138e5ceb25a98ca1595896dc61d6c144847c0f13acffc912f4b6047c7f4d2 (690fee243d3c04ca39417f4591198d93176071fb)
- b55df0184d27544bfbb29ce9da3fe89617b7aaecab49b5ae05ffcd8cfbc4f6a9 (1c27b01cd09957b01c1623e4477cef5c9f6cba09)
- ac370624dbb37c2b82d6fa17b2f5684f2586e27dfa3c1a8dd9a13ce4a4dcb0ba (e019b2123a6de8319d2d519ac87c75b37f3d97cb)
- 2119ef2c34ac8076fa9f1e0f627c1815f6e5c2b490d50831b465500f4352ad7d (6e2c15e36962190b60d31fd02f291cb9cc278dd9)
- 61a8d6905f485132fab70e578b5ea9f28927f34ecdc560da5fd03258129cca7c (383505c3897529bddc1b43c7e0fda754bbafc881)
- 009007153e1fb3c00adfa6056e3b4d69e5a432d0d5b347b5515111c51f9bc8ad (2b2a8a81a9f26c8f2dc496fdee8fc53efe177cfe)
- 47338eedd8ffbbb3f5a9cc47a6306c1932ef0fe42ebb0ea218abf7caa69875ec (da5f12f1ab50310ed990c95d32e57b1ec6e26290)
- 803548b7eea7d7363140b6f8aaf57360f973ef32663c952b21e1c1c24baa9bf5 (e34635fc42b8b461d5bf217ca0749d1d3818da40)
- fac2cf8dabde355cb397a478b1311e9d6272ab8af3ab7122f126710b3fd36b87 (9d040a0f5cbaa5e7f0879d049650b6c126d6f67a)
- 25c0f9f8e1f27f727e2ed32c449c9b0cb94ec5d2a15b8da916e63b13d895e141 (0bc0f17c7bbd86ea92f3224448448bc843608cb8)
- 6b09971df99a3b60672b21b6294001be8734c1264de3a1c37cb0dffe06141536 (b677a2e1389bc1a5ef4127c0b36baa040ce48a38)
- 3c84d0a839e6f58af193dbfafea5976ec5d5c2435f97ab08e3aa3eb4d3ff0398 (901adde839ee94caaa191a635f26bd7b1b544df9)
- 2ff8330bfd74005b3b7a257ffd0af75b0a960582de7112aa72eb30a11e704951 (61c037a1601e7887995830283710135fddb2b266)
- c0858bc5e7f8bd0ad3db5ff53452fafdaa09386d3c620ed5a58ef4fe07dfb1dc (22c282e349f3ae4d440da22e0c0e90af672f8b0f)
- 43e66b9e48cf858a1572894aee262c4c38e10faeac928b7ff2589934cc6f83f3 (42c91d625cfed7a05a3f662e2a1d6dcca475639e)
- b187339e7ae2f691d78aa1c6debf0346a26e463712ff7c1b589c6473ca9fdbc3 (43d9f7d648f74e266a228f5a99ccf9035431cab1)
- d3ec4bc329ab8e77c7f120993a0cac0ae097c2241e063ea6b785f2383e7bc4f5 (6e4e317d75d843bae6d457d3e26b948083492ade)
- c75bb478d76edd30f548673176503faeda3793d5a03e5a4667861245429d1b72 (e77522d23c26cc158022a86fb5093bee11f92f86)
- b26b736f375e0413302a3ddbb0316fa2227a55a60b1e7678117242c1eb756f8c (1c96a3cd0e980008cb9c6072b6750922ba2c4963)
- ece040cec26d5826aa5bd6f2dee393fb1cbbc5499c3603466ca7aeec86debd37 (530d897c60c4b060d5fb885abc8cfa2a76dc1714)
- 2b8985c7e56bef8e738a79e5d14608d0bf40d2b0e1802e3e23c6dc8df1e9ddfa (092aabdf1c61b49390560312d7a52b4a3ee69bf8)
- e30daceabbb304c9e1e1ca3775719e0203b57303d7c3a0403c3923132aee88cf (d55cb2b1dc5ab25de37cdebb3584bd6a90d7f15c)
- 626394dcaf3d5457e1a7f327907aa2c9c0bb93b638a2bdf566a3b653816c095e (e4c13af5b2e58aba01453e78ba94f050f2025615)
- 9578deb8ce7ec738ebf543063902b86b9771801b60b21845ee5f6f63530f35e6 (6b25fe386e0b50ceeedbf382c32d6e8a8d6963af)
- 05933c668d5658b5e175e4051064b54d03d6bf588398d4a7465916791a668795 (5aedd6ddcdd8a8e3b6d26b10d057148e1f4ff0d3)
- 4fd72f98993a86522f493405e676be94c9acfea805829bee0e1295ce16bba63c (f7c3523fc049a222bfe0057ac8ef3a5b056ef7af)
- 88172528aff7d5f4b03791c78a9538bd129960bea3241db0df6269e07e50df47 (0671164cd88d2c12a16e50acdf971b04df7f6c5f)
- afb8843ca3fd07f9d5c27d3591860dba0def1fc7f22ad33e21c1b791ff49812f (5f2a991f567c33ef3016a801223d47af47ff1d27)
- 300d9c548d0181e06510a93bf2caf000732c135de434e68f028f2cbbc52f3eaa (1529faa2a9efed99d9b9f0212706eb2d95c5737e)
- ae9c38edfd8249879219b0098cdc752da888d908e97d9e91b6a515cc5a19fa42 (6718cf655f843139065a028801df91139bc12f9e)
- f1e59e39e1d69ee71db2a85629dc85fe001b219003101e627766b07b932f3ef2 (3d109ba3e8a4984fc21b46b587125ef676d832d6)
- 7c8d8bdbe777790b6717da05f7ceaf72dfd68a238d3c65f4dcce48491a229656 (5788af833533c6bb07e6b5ed9f8e0d934b5c7e84)
- 0892eccfdf4e4f7d48b352527ffeedf8c34461476667e6f1db00f4459a1c9303 (20fd1ede412f0b0a21db386c56610d57decd1782)
- d2d40aab49b4a8ad1e98133439810184eac51541cac4032761d3ca8a595a5464 (fbe25d8ce536f7553791f6a80d43990fd291c04c)
- efb3e9bb735d25946f7656caeba94c3360da9cc8c1bcc646142a950b006531da (abac9f70886395aab744b0216d52ec5a4d6d263f)
- e772cc7a8a95bda60bf7cb1bb77defcf817c3f9d50800e835dc9b9b3aacafce0 (e5db8da65cffb6f9f025326604356361fe2dfa1d)
- ad921e5faff2f2cf3ba86483dabf36386cbb4b529efacf07dfa1b2d84aed393c (893bc912fbc065fa1e3ccdec873184ed324d4098)
- 76beca8b91163d201b98ba1949b7709c095718eced70f58e1d134245783b2a54 (548516062c7cdf6f9d2e14b3ded1440a80cebe93)
- fa1fe7119c1dbacf0132d1efb5678d0160ce877db03d9d118de4e14f86520349 (6103e328e1ff8562fe29edf5248cc63079fd2394)
- 2f22e8e7d9f2d14caf705c80fa50f8748b092dece0a0ec1e8a40b6161f61485a (7ad5bfe751b45451b70075e6a42b776c1290bf4f)
- b9c481a4de7aa7344a9ec7ea15860d8d933968e818d73288eec73b5626778aa3 (e1192c88c6666d91ae47de35d914718d7357489e)
- 2169f9355af969aa9bbb73abd14c2c6a2e7408e243761b28fccb0ad8ea84a12f (dcd20c09c07c01084e4519fd5037479d580c0a26)
- be8f1cce3a0f463240b62b24b9d4ef97b4400e560d24a55825db07a8bcbca50d (5a83f98cb387fb93ac697fb04f8f9c910ec59eaa)
- 03e2bd257936c8ecf513ba8e744afa5e6d4c1f4aebce111cbac0a2a580b7cd8a (77b9f67ce9422ad7e5f9ea29f0dfd85536afb12d)
- .DS_Store +3 -0
- .gitattributes +240 -0
- add_edges_to_make_degrees_of_all_nodes_even/.DS_Store +0 -0
- add_edges_to_make_degrees_of_all_nodes_even/haskell_tests/Main.hs +27 -0
- add_edges_to_make_degrees_of_all_nodes_even/java_tests/Main.java +25 -0
- add_edges_to_make_degrees_of_all_nodes_even/meta.json +3 -0
- add_edges_to_make_degrees_of_all_nodes_even/ocaml_tests/main.ml +29 -0
- add_edges_to_make_degrees_of_all_nodes_even/scala_tests/MySuite.scala +16 -0
- adjacent_increasing_subarrays_detection_i/haskell_tests/Main.hs +45 -0
- adjacent_increasing_subarrays_detection_i/java_tests/Main.java +21 -0
- adjacent_increasing_subarrays_detection_i/meta.json +603 -0
- adjacent_increasing_subarrays_detection_i/ocaml_tests/main.ml +50 -0
- adjacent_increasing_subarrays_detection_i/scala_tests/MySuite.scala +44 -0
- alice_and_bob_playing_flower_game/haskell_tests/Main.hs +45 -0
- alice_and_bob_playing_flower_game/java_tests/Main.java +21 -0
- alice_and_bob_playing_flower_game/meta.json +97 -0
- alice_and_bob_playing_flower_game/ocaml_tests/main.ml +50 -0
- alice_and_bob_playing_flower_game/scala_tests/MySuite.scala +44 -0
- all_divisions_with_the_highest_score_of_a_binary_array/.DS_Store +0 -0
- all_divisions_with_the_highest_score_of_a_binary_array/haskell_tests/Main.hs +27 -0
- all_divisions_with_the_highest_score_of_a_binary_array/java_tests/Main.java +25 -0
- all_divisions_with_the_highest_score_of_a_binary_array/meta.json +3 -0
- all_divisions_with_the_highest_score_of_a_binary_array/ocaml_tests/main.ml +29 -0
- all_divisions_with_the_highest_score_of_a_binary_array/scala_tests/MySuite.scala +16 -0
- alternating_groups_i/haskell_tests/Main.hs +41 -0
- alternating_groups_i/java_tests/Main.java +20 -0
- alternating_groups_i/meta.json +333 -0
- alternating_groups_i/ocaml_tests/main.ml +42 -0
- alternating_groups_i/scala_tests/MySuite.scala +32 -0
- alternating_groups_ii/haskell_tests/Main.hs +0 -0
- alternating_groups_ii/java_tests/Main.java +25 -0
- alternating_groups_ii/meta.json +0 -0
- alternating_groups_ii/ocaml_tests/main.ml +0 -0
- alternating_groups_ii/scala_tests/MySuite.scala +0 -0
- alternating_groups_iii/haskell_tests/Main.hs +0 -0
- alternating_groups_iii/java_tests/Main.java +21 -0
- alternating_groups_iii/meta.json +3 -0
- alternating_groups_iii/ocaml_tests/main.ml +0 -0
- alternating_groups_iii/scala_tests/MySuite.scala +0 -0
- ant_on_the_boundary/haskell_tests/Main.hs +41 -0
- ant_on_the_boundary/java_tests/Main.java +20 -0
- ant_on_the_boundary/meta.json +165 -0
- ant_on_the_boundary/ocaml_tests/main.ml +42 -0
- ant_on_the_boundary/scala_tests/MySuite.scala +32 -0
- append_characters_to_string_to_make_subsequence/.DS_Store +0 -0
- append_characters_to_string_to_make_subsequence/haskell_tests/Main.hs +27 -0
- append_characters_to_string_to_make_subsequence/java_tests/Main.java +25 -0
- append_characters_to_string_to_make_subsequence/meta.json +0 -0
- append_characters_to_string_to_make_subsequence/ocaml_tests/main.ml +29 -0
- append_characters_to_string_to_make_subsequence/scala_tests/MySuite.scala +16 -0
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:581110d059fa11e94ed9c16751b5904eef8afbb72f4a3b7ac783ffde1153c3d1
|
| 3 |
+
size 358404
|
|
@@ -57,3 +57,243 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
.DS_Store filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
add_edges_to_make_degrees_of_all_nodes_even/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
all_divisions_with_the_highest_score_of_a_binary_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
alternating_groups_iii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
append_k_integers_with_minimal_sum/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
apply_operations_on_array_to_maximize_sum_of_squares/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
apply_operations_to_maximize_frequency_score/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
apply_operations_to_maximize_score/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
assign_elements_to_groups_with_constraints/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
assign_elements_to_groups_with_constraints/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
check_if_grid_can_be_cut_into_sections/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
check_if_grid_can_be_cut_into_sections/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
check_if_grid_can_be_cut_into_sections/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
check_if_grid_can_be_cut_into_sections/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
closest_equal_element_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
collect_coins_in_a_tree/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
count_array_pairs_divisible_by_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
count_connected_components_in_lcm_graph/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
count_days_without_meetings/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
count_good_triplets_in_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
count_non_decreasing_subarrays_after_k_operations/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 81 |
+
count_number_of_bad_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 82 |
+
count_of_interesting_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 83 |
+
count_pairs_of_points_with_distance_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 84 |
+
count_subarrays_where_max_element_appears_at_least_k_times/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 85 |
+
count_subarrays_with_score_less_than_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 86 |
+
count_submatrices_with_equal_frequency_of_x_and_y/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 87 |
+
count_submatrices_with_equal_frequency_of_x_and_y/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 88 |
+
count_substrings_that_satisfy_k_constraint_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 89 |
+
count_substrings_that_satisfy_k_constraint_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 90 |
+
count_the_number_of_beautiful_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 91 |
+
count_the_number_of_good_nodes/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 92 |
+
count_the_number_of_good_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 93 |
+
count_the_number_of_good_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
count_the_number_of_houses_at_a_certain_distance_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
count_unreachable_pairs_of_nodes_in_an_undirected_graph/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
count_unreachable_pairs_of_nodes_in_an_undirected_graph/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
count_unreachable_pairs_of_nodes_in_an_undirected_graph/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
count_unreachable_pairs_of_nodes_in_an_undirected_graph/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
count_ways_to_group_overlapping_ranges/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
count_zero_request_servers/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
count_zero_request_servers/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 102 |
+
count_zero_request_servers/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
|
| 103 |
+
count_zero_request_servers/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 104 |
+
create_components_with_same_value/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 105 |
+
cycle_length_queries_in_a_tree/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 106 |
+
destroy_sequential_targets/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 107 |
+
difference_between_maximum_and_minimum_price_sum/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 108 |
+
difference_between_maximum_and_minimum_price_sum/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 109 |
+
difference_between_ones_and_zeros_in_row_and_column/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 110 |
+
distribute_elements_into_two_arrays_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 111 |
+
distribute_elements_into_two_arrays_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 112 |
+
divide_an_array_into_subarrays_with_minimum_cost_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 113 |
+
divide_array_into_arrays_with_max_difference/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 114 |
+
divide_intervals_into_minimum_number_of_groups/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 115 |
+
eat_pizzas/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 116 |
+
find_all_good_indices/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 117 |
+
find_building_where_alice_and_bob_can_meet/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 118 |
+
find_building_where_alice_and_bob_can_meet/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 119 |
+
find_closest_node_to_given_two_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 120 |
+
find_indices_with_index_and_value_difference_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 121 |
+
find_number_of_coins_to_place_in_tree_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 122 |
+
find_occurrences_of_an_element_in_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 123 |
+
find_subtree_sizes_after_changes/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 124 |
+
find_the_first_player_to_win_k_games_in_a_row/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 125 |
+
find_the_k_sum_of_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 126 |
+
find_the_longest_equal_subarray/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 127 |
+
find_the_maximum_number_of_marked_indices/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 128 |
+
find_the_minimum_area_to_cover_all_ones_i/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 129 |
+
find_the_number_of_good_pairs_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 130 |
+
find_the_original_array_of_prefix_xor/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 131 |
+
find_the_score_of_all_prefixes_of_an_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 132 |
+
find_x_sum_of_all_k_long_subarrays_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 133 |
+
find_x_sum_of_all_k_long_subarrays_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 134 |
+
frog_jump_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 135 |
+
fruits_into_baskets_iii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 136 |
+
fruits_into_baskets_iii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 137 |
+
handling_sum_queries_after_update/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 138 |
+
house_robber_iv/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 139 |
+
increment_submatrices_by_one/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 140 |
+
intervals_between_identical_elements/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 141 |
+
k_th_nearest_obstacle_queries/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 142 |
+
k_th_nearest_obstacle_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 143 |
+
largest_combination_with_bitwise_and_greater_than_zero/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 144 |
+
largest_element_in_an_array_after_merge_operations/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 145 |
+
length_of_longest_subarray_with_at_most_k_frequency/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 146 |
+
length_of_the_longest_increasing_path/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 147 |
+
length_of_the_longest_increasing_path/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 148 |
+
longest_non_decreasing_subarray_from_two_arrays/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 149 |
+
longest_non_decreasing_subarray_from_two_arrays/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 150 |
+
longest_palindrome_by_concatenating_two_letter_words/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 151 |
+
longest_path_with_different_adjacent_characters/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 152 |
+
longest_special_path/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 153 |
+
longest_special_path_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 154 |
+
longest_subarray_with_maximum_bitwise_and/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 155 |
+
max_sum_of_a_pair_with_equal_sum_of_digits/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 156 |
+
maximal_score_after_applying_k_operations/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 157 |
+
maximize_happiness_of_selected_children/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 158 |
+
maximize_happiness_of_selected_children/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 159 |
+
maximize_score_of_numbers_in_ranges/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 160 |
+
maximize_sum_of_weights_after_edge_removals/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 161 |
+
maximize_sum_of_weights_after_edge_removals/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 162 |
+
maximize_sum_of_weights_after_edge_removals/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
|
| 163 |
+
maximize_sum_of_weights_after_edge_removals/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 164 |
+
maximize_the_profit_as_the_salesman/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 165 |
+
maximize_value_of_function_in_a_ball_passing_game/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 166 |
+
maximize_win_from_two_segments/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 167 |
+
maximum_and_minimum_sums_of_at_most_size_k_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 168 |
+
maximum_bags_with_full_capacity_of_rocks/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 169 |
+
maximum_beauty_of_an_array_after_applying_operation/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 170 |
+
maximum_coins_from_k_consecutive_bags/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 171 |
+
maximum_coins_from_k_consecutive_bags/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 172 |
+
maximum_consecutive_floors_without_special_floors/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 173 |
+
maximum_difference_score_in_a_grid/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 174 |
+
maximum_difference_score_in_a_grid/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 175 |
+
maximum_elegance_of_a_k_length_subsequence/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 176 |
+
maximum_frequency_after_subarray_operation/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 177 |
+
maximum_frequency_of_an_element_after_performing_operations_i/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 178 |
+
maximum_frequency_of_an_element_after_performing_operations_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 179 |
+
maximum_good_subarray_sum/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 180 |
+
maximum_matching_of_players_with_trainers/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 181 |
+
maximum_number_of_groups_entering_a_competition/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 182 |
+
maximum_number_of_groups_with_increasing_length/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 183 |
+
maximum_number_of_k_divisible_components/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 184 |
+
maximum_or/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 185 |
+
maximum_points_after_collecting_coins_from_all_nodes/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 186 |
+
maximum_points_after_collecting_coins_from_all_nodes/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 187 |
+
maximum_points_after_collecting_coins_from_all_nodes/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 188 |
+
maximum_prime_difference/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 189 |
+
maximum_score_after_applying_operations_on_a_tree/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 190 |
+
maximum_score_of_a_node_sequence/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 191 |
+
maximum_star_sum_of_a_graph/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 192 |
+
maximum_subarray_sum_with_length_divisible_by_k/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 193 |
+
maximum_subarray_sum_with_length_divisible_by_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 194 |
+
maximum_sum_of_distinct_subarrays_with_length_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 195 |
+
maximum_sum_of_subsequence_with_non_adjacent_elements/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 196 |
+
maximum_sum_queries/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 197 |
+
maximum_sum_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 198 |
+
maximum_sum_queries/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
|
| 199 |
+
maximum_sum_queries/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 200 |
+
maximum_tastiness_of_candy_basket/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 201 |
+
maximum_total_beauty_of_the_gardens/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 202 |
+
maximum_total_importance_of_roads/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 203 |
+
maximum_xor_score_subarray_queries/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 204 |
+
maximum_xor_score_subarray_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 205 |
+
maximum_xor_score_subarray_queries/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 206 |
+
meeting_rooms_iii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 207 |
+
meta2/.DS_Store filter=lfs diff=lfs merge=lfs -text
|
| 208 |
+
meta2/add_edges_to_make_degrees_of_all_nodes_even/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 209 |
+
meta2/all_divisions_with_the_highest_score_of_a_binary_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 210 |
+
mice_and_cheese/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 211 |
+
minimize_maximum_of_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 212 |
+
minimize_or_of_remaining_elements_using_operations/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 213 |
+
minimize_the_maximum_difference_of_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 214 |
+
minimum_absolute_difference_between_elements_with_constraint/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 215 |
+
minimum_array_length_after_pair_removals/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 216 |
+
minimum_cost_to_equalize_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 217 |
+
minimum_cost_to_make_arrays_identical/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 218 |
+
minimum_difference_in_sums_after_removal_of_elements/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 219 |
+
minimum_fuel_cost_to_report_to_the_capital/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 220 |
+
minimum_impossible_or/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 221 |
+
minimum_lines_to_represent_a_line_chart/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 222 |
+
minimum_money_required_before_transactions/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 223 |
+
minimum_number_of_coins_to_be_added/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 224 |
+
minimum_number_of_operations_to_make_array_xor_equal_to_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 225 |
+
minimum_number_of_operations_to_make_arrays_similar/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 226 |
+
minimum_number_of_operations_to_satisfy_conditions/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 227 |
+
minimum_operations_to_exceed_threshold_value_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 228 |
+
minimum_operations_to_exceed_threshold_value_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 229 |
+
minimum_operations_to_halve_array_sum/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 230 |
+
minimum_operations_to_make_array_equal_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 231 |
+
minimum_operations_to_make_array_equal_to_target/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 232 |
+
minimum_operations_to_make_array_equal_to_target/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 233 |
+
minimum_operations_to_make_median_of_array_equal_to_k/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 234 |
+
minimum_operations_to_make_median_of_array_equal_to_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 235 |
+
minimum_operations_to_make_the_array_alternating/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 236 |
+
minimum_processing_time/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 237 |
+
minimum_rectangles_to_cover_points/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 238 |
+
minimum_rectangles_to_cover_points/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 239 |
+
minimum_rectangles_to_cover_points/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 240 |
+
minimum_replacements_to_sort_the_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 241 |
+
minimum_rounds_to_complete_all_tasks/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 242 |
+
minimum_score_of_a_path_between_two_cities/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 243 |
+
minimum_seconds_to_equalize_a_circular_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 244 |
+
minimum_size_subarray_in_infinite_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 245 |
+
minimum_sum_of_squared_difference/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 246 |
+
minimum_swaps_to_group_all_1s_together_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 247 |
+
minimum_time_to_complete_trips/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 248 |
+
minimum_time_to_finish_the_race/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 249 |
+
minimum_time_to_repair_cars/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 250 |
+
minimum_total_cost_to_make_arrays_unequal/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 251 |
+
most_popular_video_creator/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 252 |
+
movement_of_robots/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 253 |
+
next_greater_element_iv/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 254 |
+
node_with_highest_edge_score/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 255 |
+
number_of_excellent_pairs/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 256 |
+
number_of_flowers_in_full_bloom/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 257 |
+
number_of_increasing_paths_in_a_grid/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 258 |
+
number_of_increasing_paths_in_a_grid/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 259 |
+
number_of_pairs_satisfying_inequality/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 260 |
+
number_of_zero_filled_subarrays/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 261 |
+
paint_house_iv/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 262 |
+
paint_house_iv/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 263 |
+
partition_array_according_to_given_pivot/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 264 |
+
partition_array_such_that_maximum_difference_is_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 265 |
+
paths_in_matrix_whose_sum_is_divisible_by_k/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 266 |
+
reachable_nodes_with_restrictions/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 267 |
+
rearrange_array_elements_by_sign/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 268 |
+
rearranging_fruits/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 269 |
+
remove_methods_from_project/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 270 |
+
remove_methods_from_project/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 271 |
+
remove_methods_from_project/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
|
| 272 |
+
remove_methods_from_project/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 273 |
+
removing_minimum_number_of_magic_beans/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 274 |
+
replace_non_coprime_numbers_in_array/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 275 |
+
robot_collisions/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 276 |
+
shifting_letters_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 277 |
+
shortest_impossible_sequence_of_rolls/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 278 |
+
shortest_subarray_with_or_at_least_k_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 279 |
+
sliding_subarray_beauty/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 280 |
+
smallest_missing_non_negative_integer_after_operations/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 281 |
+
solving_questions_with_brainpower/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 282 |
+
sorted_gcd_pair_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 283 |
+
steps_to_make_array_non_decreasing/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 284 |
+
subarray_with_elements_greater_than_varying_threshold/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 285 |
+
substring_xor_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 286 |
+
successful_pairs_of_spells_and_potions/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 287 |
+
sum_of_distances/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 288 |
+
sum_of_matrix_after_queries/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 289 |
+
task_scheduler_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 290 |
+
total_cost_to_hire_k_workers/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 291 |
+
zero_array_transformation_i/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 292 |
+
zero_array_transformation_i/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 293 |
+
zero_array_transformation_i/ocaml_tests/main.ml filter=lfs diff=lfs merge=lfs -text
|
| 294 |
+
zero_array_transformation_i/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 295 |
+
zero_array_transformation_ii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 296 |
+
zero_array_transformation_ii/meta.json filter=lfs diff=lfs merge=lfs -text
|
| 297 |
+
zero_array_transformation_ii/scala_tests/MySuite.scala filter=lfs diff=lfs merge=lfs -text
|
| 298 |
+
zero_array_transformation_iii/haskell_tests/Main.hs filter=lfs diff=lfs merge=lfs -text
|
| 299 |
+
zero_array_transformation_iii/meta.json filter=lfs diff=lfs merge=lfs -text
|
|
Binary file (6.15 kB). View file
|
|
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (isPossible 5 [[1,2],[2,3],[3,4],[4,2],[1,4],[2,5]])," True (isPossible 5 [[1,2],[2,3],[3,4],[4,2],[1,4],[2,5]]))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (isPossible 4 [[1,2],[3,4]])," True (isPossible 4 [[1,2],[3,4]]))
|
| 16 |
+
|
| 17 |
+
test3 :: Test
|
| 18 |
+
test3 = TestCase (assertEqual "for (isPossible 4 [[1,2],[1,3],[1,4]])," False (isPossible 4 [[1,2],[1,3],[1,4]]))
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
-- Grouping test cases
|
| 22 |
+
tests :: Test
|
| 23 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
|
| 24 |
+
|
| 25 |
+
-- Running the tests
|
| 26 |
+
main :: IO Counts
|
| 27 |
+
main = runTestTT tests
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(true, isPossible(5, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(2,3)),new ArrayList<>(Arrays.asList(3,4)),new ArrayList<>(Arrays.asList(4,2)),new ArrayList<>(Arrays.asList(1,4)),new ArrayList<>(Arrays.asList(2,5))))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(true, isPossible(4, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(3,4))))));
|
| 19 |
+
}
|
| 20 |
+
@Test
|
| 21 |
+
public void test3() {
|
| 22 |
+
assertEquals(false, isPossible(4, new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,2)),new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(1,4))))));
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:26b3d803db7b998bccd4920f2700d94c046456ec26a0c24cc4daeca7d5d672a4
|
| 3 |
+
size 48906019
|
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal true (isPossible 5 [[1;2];[2;3];[3;4];[4;2];[1;4];[2;5]])
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal true (isPossible 4 [[1;2];[3;4]])
|
| 14 |
+
|
| 15 |
+
let test3 _ = assert_equal false (isPossible 4 [[1;2];[1;3];[1;4]])
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
(* Grouping test cases *)
|
| 19 |
+
let suite = "Test Suite for isPossible" >::: [
|
| 20 |
+
|
| 21 |
+
"test1" >:: test1;
|
| 22 |
+
"test2" >:: test2;
|
| 23 |
+
"test3" >:: test3;
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
(* Running the tests *)
|
| 28 |
+
let () = run_test_tt_main suite
|
| 29 |
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.isPossible(5,List(List(1,2),List(2,3),List(3,4),List(4,2),List(1,4),List(2,5))), true)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.isPossible(4,List(List(1,2),List(3,4))), true)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.isPossible(4,List(List(1,2),List(1,3),List(1,4))), false)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (hasIncreasingSubarrays [2,5,7,8,9,2,3,4,3,1] 3)," True (hasIncreasingSubarrays [2,5,7,8,9,2,3,4,3,1] 3))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (hasIncreasingSubarrays [1,2,3,4,4,4,4,5,6,7] 5)," False (hasIncreasingSubarrays [1,2,3,4,4,4,4,5,6,7] 5))
|
| 16 |
+
|
| 17 |
+
test3 :: Test
|
| 18 |
+
test3 = TestCase (assertEqual "for (hasIncreasingSubarrays [-669, 939, ( -671), ( -764), ( -122), 65, 433, ( -158), 532, ( -539), 634, ( -912), ( -271), 596, 397, 732, ( -474), 665, 518, 851, 3, 290, ( -172), ( -303), ( -856), 594, ( -99), 265, ( -948), ( -66), 381, ( -217), 765, 992, ( -799), ( -962), ( -359), ( -116), ( -737), ( -271), 441, 552, ( -845), ( -663), ( -415), 23, 987] 20)," False (hasIncreasingSubarrays [-669, 939, -671, -764, -122, 65, 433, -158, 532, -539, 634, -912, -271, 596, 397, 732, -474, 665, 518, 851, 3, 290, -172, -303, -856, 594, -99, 265, -948, -66, 381, -217, 765, 992, -799, -962, -359, -116, -737, -271, 441, 552, -845, -663, -415, 23, 987] 20))
|
| 19 |
+
|
| 20 |
+
test4 :: Test
|
| 21 |
+
test4 = TestCase (assertEqual "for (hasIncreasingSubarrays [846, ( -627), 915, ( -300), ( -391), ( -505), 507] 2)," False (hasIncreasingSubarrays [846, -627, 915, -300, -391, -505, 507] 2))
|
| 22 |
+
|
| 23 |
+
test5 :: Test
|
| 24 |
+
test5 = TestCase (assertEqual "for (hasIncreasingSubarrays [871, ( -896), ( -232), 537, 464, 728, ( -10), ( -927), ( -539), ( -113), 928, 555, 775, ( -900), ( -289), 795, ( -849), 450, 253, 450, ( -308), ( -589), ( -563), 848, 119, ( -780), ( -381)] 5)," False (hasIncreasingSubarrays [871, -896, -232, 537, 464, 728, -10, -927, -539, -113, 928, 555, 775, -900, -289, 795, -849, 450, 253, 450, -308, -589, -563, 848, 119, -780, -381] 5))
|
| 25 |
+
|
| 26 |
+
test6 :: Test
|
| 27 |
+
test6 = TestCase (assertEqual "for (hasIncreasingSubarrays [0, ( -807), 367, 485, 105, 174, ( -444), ( -479), ( -440), ( -626), ( -645), 422, 608, 881, ( -2), 147, ( -796), ( -752), 799, ( -782), ( -281), ( -955), ( -700), ( -946), ( -175), 134, 738, ( -983), 441, 284, 545, ( -597), ( -168), ( -53), 702, ( -845), ( -34), 126, ( -351), 842, 257, 59, 821, ( -974), 546, ( -628), ( -55), ( -452), 203, ( -793), ( -251), ( -515), 284] 16)," False (hasIncreasingSubarrays [0, -807, 367, 485, 105, 174, -444, -479, -440, -626, -645, 422, 608, 881, -2, 147, -796, -752, 799, -782, -281, -955, -700, -946, -175, 134, 738, -983, 441, 284, 545, -597, -168, -53, 702, -845, -34, 126, -351, 842, 257, 59, 821, -974, 546, -628, -55, -452, 203, -793, -251, -515, 284] 16))
|
| 28 |
+
|
| 29 |
+
test7 :: Test
|
| 30 |
+
test7 = TestCase (assertEqual "for (hasIncreasingSubarrays [-256, ( -176), 324, ( -573), ( -964), ( -489), ( -141), 884, ( -44), 137, 492, 813, ( -442), 608, ( -455), 971, ( -200), 940, 772, 359, ( -886), ( -454), ( -148), ( -473), ( -344), 18, 292, 137, ( -893), 238, ( -706), 974, ( -980), ( -639), ( -51), 267] 6)," False (hasIncreasingSubarrays [-256, -176, 324, -573, -964, -489, -141, 884, -44, 137, 492, 813, -442, 608, -455, 971, -200, 940, 772, 359, -886, -454, -148, -473, -344, 18, 292, 137, -893, 238, -706, 974, -980, -639, -51, 267] 6))
|
| 31 |
+
|
| 32 |
+
test8 :: Test
|
| 33 |
+
test8 = TestCase (assertEqual "for (hasIncreasingSubarrays [-744, 380, 344, 139, 841, 750, 102, ( -653), ( -428), ( -138), 104, 987, 604, ( -83), ( -428), ( -414), 664, ( -601), 663, ( -907), 190, 180, 926, ( -533), ( -872)] 3)," False (hasIncreasingSubarrays [-744, 380, 344, 139, 841, 750, 102, -653, -428, -138, 104, 987, 604, -83, -428, -414, 664, -601, 663, -907, 190, 180, 926, -533, -872] 3))
|
| 34 |
+
|
| 35 |
+
test9 :: Test
|
| 36 |
+
test9 = TestCase (assertEqual "for (hasIncreasingSubarrays [945, ( -656), 548, ( -31), 150, 186, 646, ( -910), 998, 336, 297, ( -267), 255, 748, ( -171), 488, ( -426), 826, ( -497), ( -228), 558, ( -875), 606, ( -372), ( -83), ( -63), ( -639), 195, 747, ( -795), ( -198), 102, 187, ( -546), ( -325), 414, 839, 890, 959, ( -581), ( -662), 365, 369, 12, ( -955), ( -657), ( -199), 56, ( -141), 382, ( -892), ( -461), 259, ( -574), ( -677), ( -211), ( -170), 889, ( -221), 462, 901, 291, 588, 863, 193, 376, ( -358), ( -677), 620, ( -717), 782, 813, ( -329), ( -424), ( -901)] 18)," False (hasIncreasingSubarrays [945, -656, 548, -31, 150, 186, 646, -910, 998, 336, 297, -267, 255, 748, -171, 488, -426, 826, -497, -228, 558, -875, 606, -372, -83, -63, -639, 195, 747, -795, -198, 102, 187, -546, -325, 414, 839, 890, 959, -581, -662, 365, 369, 12, -955, -657, -199, 56, -141, 382, -892, -461, 259, -574, -677, -211, -170, 889, -221, 462, 901, 291, 588, 863, 193, 376, -358, -677, 620, -717, 782, 813, -329, -424, -901] 18))
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
-- Grouping test cases
|
| 40 |
+
tests :: Test
|
| 41 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
|
| 42 |
+
|
| 43 |
+
-- Running the tests
|
| 44 |
+
main :: IO Counts
|
| 45 |
+
main = runTestTT tests
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(true, hasIncreasingSubarrays(new ArrayList<>(Arrays.asList(2,5,7,8,9,2,3,4,3,1)), 3));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(fals, hasIncreasingSubarrays(new ArrayList<>(Arrays.asList(1,2,3,4,4,4,4,5,6,7)), 5));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
|
@@ -0,0 +1,603 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 3612,
|
| 3 |
+
"name": "adjacent_increasing_subarrays_detection_i",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/adjacent-increasing-subarrays-detection-i/",
|
| 6 |
+
"date": "2024-11-03 00:00:00",
|
| 7 |
+
"task_description": "Given an array `nums` of `n` integers and an integer `k`, determine whether there exist **two** **adjacent** subarrays of length `k` such that both subarrays are **strictly** **increasing**. Specifically, check if there are **two** subarrays starting at indices `a` and `b` (`a < b`), where: Both subarrays `nums[a..a + k - 1]` and `nums[b..b + k - 1]` are **strictly increasing**. The subarrays must be **adjacent**, meaning `b = a + k`. Return `true` if it is _possible_ to find **two **such subarrays, and `false` otherwise. **Example 1:** **Input:** nums = [2,5,7,8,9,2,3,4,3,1], k = 3 **Output:** true **Explanation:** The subarray starting at index `2` is `[7, 8, 9]`, which is strictly increasing. The subarray starting at index `5` is `[2, 3, 4]`, which is also strictly increasing. These two subarrays are adjacent, so the result is `true`. **Example 2:** **Input:** nums = [1,2,3,4,4,4,4,5,6,7], k = 5 **Output:** false **Constraints:** `2 <= nums.length <= 100` `1 < 2 * k <= nums.length` `-1000 <= nums[i] <= 1000`",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "nums = [2,5,7,8,9,2,3,4,3,1], k = 3",
|
| 12 |
+
"output": "true "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "nums = [1,2,3,4,4,4,4,5,6,7], k = 5",
|
| 17 |
+
"output": "false"
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"private_test_cases": [
|
| 21 |
+
{
|
| 22 |
+
"input": [
|
| 23 |
+
[
|
| 24 |
+
-669,
|
| 25 |
+
939,
|
| 26 |
+
-671,
|
| 27 |
+
-764,
|
| 28 |
+
-122,
|
| 29 |
+
65,
|
| 30 |
+
433,
|
| 31 |
+
-158,
|
| 32 |
+
532,
|
| 33 |
+
-539,
|
| 34 |
+
634,
|
| 35 |
+
-912,
|
| 36 |
+
-271,
|
| 37 |
+
596,
|
| 38 |
+
397,
|
| 39 |
+
732,
|
| 40 |
+
-474,
|
| 41 |
+
665,
|
| 42 |
+
518,
|
| 43 |
+
851,
|
| 44 |
+
3,
|
| 45 |
+
290,
|
| 46 |
+
-172,
|
| 47 |
+
-303,
|
| 48 |
+
-856,
|
| 49 |
+
594,
|
| 50 |
+
-99,
|
| 51 |
+
265,
|
| 52 |
+
-948,
|
| 53 |
+
-66,
|
| 54 |
+
381,
|
| 55 |
+
-217,
|
| 56 |
+
765,
|
| 57 |
+
992,
|
| 58 |
+
-799,
|
| 59 |
+
-962,
|
| 60 |
+
-359,
|
| 61 |
+
-116,
|
| 62 |
+
-737,
|
| 63 |
+
-271,
|
| 64 |
+
441,
|
| 65 |
+
552,
|
| 66 |
+
-845,
|
| 67 |
+
-663,
|
| 68 |
+
-415,
|
| 69 |
+
23,
|
| 70 |
+
987
|
| 71 |
+
],
|
| 72 |
+
20
|
| 73 |
+
],
|
| 74 |
+
"output": false
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"input": [
|
| 78 |
+
[
|
| 79 |
+
846,
|
| 80 |
+
-627,
|
| 81 |
+
915,
|
| 82 |
+
-300,
|
| 83 |
+
-391,
|
| 84 |
+
-505,
|
| 85 |
+
507
|
| 86 |
+
],
|
| 87 |
+
2
|
| 88 |
+
],
|
| 89 |
+
"output": false
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"input": [
|
| 93 |
+
[
|
| 94 |
+
871,
|
| 95 |
+
-896,
|
| 96 |
+
-232,
|
| 97 |
+
537,
|
| 98 |
+
464,
|
| 99 |
+
728,
|
| 100 |
+
-10,
|
| 101 |
+
-927,
|
| 102 |
+
-539,
|
| 103 |
+
-113,
|
| 104 |
+
928,
|
| 105 |
+
555,
|
| 106 |
+
775,
|
| 107 |
+
-900,
|
| 108 |
+
-289,
|
| 109 |
+
795,
|
| 110 |
+
-849,
|
| 111 |
+
450,
|
| 112 |
+
253,
|
| 113 |
+
450,
|
| 114 |
+
-308,
|
| 115 |
+
-589,
|
| 116 |
+
-563,
|
| 117 |
+
848,
|
| 118 |
+
119,
|
| 119 |
+
-780,
|
| 120 |
+
-381
|
| 121 |
+
],
|
| 122 |
+
5
|
| 123 |
+
],
|
| 124 |
+
"output": false
|
| 125 |
+
},
|
| 126 |
+
{
|
| 127 |
+
"input": [
|
| 128 |
+
[
|
| 129 |
+
0,
|
| 130 |
+
-807,
|
| 131 |
+
367,
|
| 132 |
+
485,
|
| 133 |
+
105,
|
| 134 |
+
174,
|
| 135 |
+
-444,
|
| 136 |
+
-479,
|
| 137 |
+
-440,
|
| 138 |
+
-626,
|
| 139 |
+
-645,
|
| 140 |
+
422,
|
| 141 |
+
608,
|
| 142 |
+
881,
|
| 143 |
+
-2,
|
| 144 |
+
147,
|
| 145 |
+
-796,
|
| 146 |
+
-752,
|
| 147 |
+
799,
|
| 148 |
+
-782,
|
| 149 |
+
-281,
|
| 150 |
+
-955,
|
| 151 |
+
-700,
|
| 152 |
+
-946,
|
| 153 |
+
-175,
|
| 154 |
+
134,
|
| 155 |
+
738,
|
| 156 |
+
-983,
|
| 157 |
+
441,
|
| 158 |
+
284,
|
| 159 |
+
545,
|
| 160 |
+
-597,
|
| 161 |
+
-168,
|
| 162 |
+
-53,
|
| 163 |
+
702,
|
| 164 |
+
-845,
|
| 165 |
+
-34,
|
| 166 |
+
126,
|
| 167 |
+
-351,
|
| 168 |
+
842,
|
| 169 |
+
257,
|
| 170 |
+
59,
|
| 171 |
+
821,
|
| 172 |
+
-974,
|
| 173 |
+
546,
|
| 174 |
+
-628,
|
| 175 |
+
-55,
|
| 176 |
+
-452,
|
| 177 |
+
203,
|
| 178 |
+
-793,
|
| 179 |
+
-251,
|
| 180 |
+
-515,
|
| 181 |
+
284
|
| 182 |
+
],
|
| 183 |
+
16
|
| 184 |
+
],
|
| 185 |
+
"output": false
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"input": [
|
| 189 |
+
[
|
| 190 |
+
-256,
|
| 191 |
+
-176,
|
| 192 |
+
324,
|
| 193 |
+
-573,
|
| 194 |
+
-964,
|
| 195 |
+
-489,
|
| 196 |
+
-141,
|
| 197 |
+
884,
|
| 198 |
+
-44,
|
| 199 |
+
137,
|
| 200 |
+
492,
|
| 201 |
+
813,
|
| 202 |
+
-442,
|
| 203 |
+
608,
|
| 204 |
+
-455,
|
| 205 |
+
971,
|
| 206 |
+
-200,
|
| 207 |
+
940,
|
| 208 |
+
772,
|
| 209 |
+
359,
|
| 210 |
+
-886,
|
| 211 |
+
-454,
|
| 212 |
+
-148,
|
| 213 |
+
-473,
|
| 214 |
+
-344,
|
| 215 |
+
18,
|
| 216 |
+
292,
|
| 217 |
+
137,
|
| 218 |
+
-893,
|
| 219 |
+
238,
|
| 220 |
+
-706,
|
| 221 |
+
974,
|
| 222 |
+
-980,
|
| 223 |
+
-639,
|
| 224 |
+
-51,
|
| 225 |
+
267
|
| 226 |
+
],
|
| 227 |
+
6
|
| 228 |
+
],
|
| 229 |
+
"output": false
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"input": [
|
| 233 |
+
[
|
| 234 |
+
-744,
|
| 235 |
+
380,
|
| 236 |
+
344,
|
| 237 |
+
139,
|
| 238 |
+
841,
|
| 239 |
+
750,
|
| 240 |
+
102,
|
| 241 |
+
-653,
|
| 242 |
+
-428,
|
| 243 |
+
-138,
|
| 244 |
+
104,
|
| 245 |
+
987,
|
| 246 |
+
604,
|
| 247 |
+
-83,
|
| 248 |
+
-428,
|
| 249 |
+
-414,
|
| 250 |
+
664,
|
| 251 |
+
-601,
|
| 252 |
+
663,
|
| 253 |
+
-907,
|
| 254 |
+
190,
|
| 255 |
+
180,
|
| 256 |
+
926,
|
| 257 |
+
-533,
|
| 258 |
+
-872
|
| 259 |
+
],
|
| 260 |
+
3
|
| 261 |
+
],
|
| 262 |
+
"output": false
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"input": [
|
| 266 |
+
[
|
| 267 |
+
945,
|
| 268 |
+
-656,
|
| 269 |
+
548,
|
| 270 |
+
-31,
|
| 271 |
+
150,
|
| 272 |
+
186,
|
| 273 |
+
646,
|
| 274 |
+
-910,
|
| 275 |
+
998,
|
| 276 |
+
336,
|
| 277 |
+
297,
|
| 278 |
+
-267,
|
| 279 |
+
255,
|
| 280 |
+
748,
|
| 281 |
+
-171,
|
| 282 |
+
488,
|
| 283 |
+
-426,
|
| 284 |
+
826,
|
| 285 |
+
-497,
|
| 286 |
+
-228,
|
| 287 |
+
558,
|
| 288 |
+
-875,
|
| 289 |
+
606,
|
| 290 |
+
-372,
|
| 291 |
+
-83,
|
| 292 |
+
-63,
|
| 293 |
+
-639,
|
| 294 |
+
195,
|
| 295 |
+
747,
|
| 296 |
+
-795,
|
| 297 |
+
-198,
|
| 298 |
+
102,
|
| 299 |
+
187,
|
| 300 |
+
-546,
|
| 301 |
+
-325,
|
| 302 |
+
414,
|
| 303 |
+
839,
|
| 304 |
+
890,
|
| 305 |
+
959,
|
| 306 |
+
-581,
|
| 307 |
+
-662,
|
| 308 |
+
365,
|
| 309 |
+
369,
|
| 310 |
+
12,
|
| 311 |
+
-955,
|
| 312 |
+
-657,
|
| 313 |
+
-199,
|
| 314 |
+
56,
|
| 315 |
+
-141,
|
| 316 |
+
382,
|
| 317 |
+
-892,
|
| 318 |
+
-461,
|
| 319 |
+
259,
|
| 320 |
+
-574,
|
| 321 |
+
-677,
|
| 322 |
+
-211,
|
| 323 |
+
-170,
|
| 324 |
+
889,
|
| 325 |
+
-221,
|
| 326 |
+
462,
|
| 327 |
+
901,
|
| 328 |
+
291,
|
| 329 |
+
588,
|
| 330 |
+
863,
|
| 331 |
+
193,
|
| 332 |
+
376,
|
| 333 |
+
-358,
|
| 334 |
+
-677,
|
| 335 |
+
620,
|
| 336 |
+
-717,
|
| 337 |
+
782,
|
| 338 |
+
813,
|
| 339 |
+
-329,
|
| 340 |
+
-424,
|
| 341 |
+
-901
|
| 342 |
+
],
|
| 343 |
+
18
|
| 344 |
+
],
|
| 345 |
+
"output": false
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"input": [
|
| 349 |
+
[
|
| 350 |
+
-344,
|
| 351 |
+
743,
|
| 352 |
+
491,
|
| 353 |
+
216,
|
| 354 |
+
42,
|
| 355 |
+
-955,
|
| 356 |
+
-472,
|
| 357 |
+
-736,
|
| 358 |
+
582,
|
| 359 |
+
-552,
|
| 360 |
+
814,
|
| 361 |
+
538,
|
| 362 |
+
35,
|
| 363 |
+
-988,
|
| 364 |
+
971,
|
| 365 |
+
362,
|
| 366 |
+
227,
|
| 367 |
+
-42,
|
| 368 |
+
709,
|
| 369 |
+
-704,
|
| 370 |
+
-529,
|
| 371 |
+
-537,
|
| 372 |
+
172,
|
| 373 |
+
609,
|
| 374 |
+
217,
|
| 375 |
+
-73,
|
| 376 |
+
-444,
|
| 377 |
+
67,
|
| 378 |
+
-820,
|
| 379 |
+
-687,
|
| 380 |
+
-158,
|
| 381 |
+
738,
|
| 382 |
+
605,
|
| 383 |
+
804,
|
| 384 |
+
-779,
|
| 385 |
+
463,
|
| 386 |
+
-677,
|
| 387 |
+
491,
|
| 388 |
+
-459,
|
| 389 |
+
-479,
|
| 390 |
+
-856,
|
| 391 |
+
680,
|
| 392 |
+
-499,
|
| 393 |
+
-349,
|
| 394 |
+
-864,
|
| 395 |
+
-462,
|
| 396 |
+
359,
|
| 397 |
+
119,
|
| 398 |
+
-916,
|
| 399 |
+
43,
|
| 400 |
+
699,
|
| 401 |
+
-488,
|
| 402 |
+
325,
|
| 403 |
+
559,
|
| 404 |
+
487,
|
| 405 |
+
151,
|
| 406 |
+
595,
|
| 407 |
+
425,
|
| 408 |
+
-785,
|
| 409 |
+
706,
|
| 410 |
+
390,
|
| 411 |
+
215,
|
| 412 |
+
-883,
|
| 413 |
+
-693,
|
| 414 |
+
446
|
| 415 |
+
],
|
| 416 |
+
3
|
| 417 |
+
],
|
| 418 |
+
"output": true
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"input": [
|
| 422 |
+
[
|
| 423 |
+
-996,
|
| 424 |
+
361,
|
| 425 |
+
-258,
|
| 426 |
+
-631,
|
| 427 |
+
-979,
|
| 428 |
+
897,
|
| 429 |
+
-327,
|
| 430 |
+
-292,
|
| 431 |
+
337,
|
| 432 |
+
-78,
|
| 433 |
+
-520,
|
| 434 |
+
219,
|
| 435 |
+
-781,
|
| 436 |
+
543,
|
| 437 |
+
337,
|
| 438 |
+
-380,
|
| 439 |
+
-594,
|
| 440 |
+
890,
|
| 441 |
+
364,
|
| 442 |
+
384,
|
| 443 |
+
-513,
|
| 444 |
+
144,
|
| 445 |
+
-925,
|
| 446 |
+
315,
|
| 447 |
+
273,
|
| 448 |
+
363,
|
| 449 |
+
-984,
|
| 450 |
+
170,
|
| 451 |
+
-841,
|
| 452 |
+
-78,
|
| 453 |
+
-801,
|
| 454 |
+
892,
|
| 455 |
+
-630,
|
| 456 |
+
193,
|
| 457 |
+
212,
|
| 458 |
+
157,
|
| 459 |
+
403,
|
| 460 |
+
238,
|
| 461 |
+
-718,
|
| 462 |
+
-641,
|
| 463 |
+
944,
|
| 464 |
+
219,
|
| 465 |
+
-227,
|
| 466 |
+
-986,
|
| 467 |
+
-432,
|
| 468 |
+
165,
|
| 469 |
+
629,
|
| 470 |
+
-137,
|
| 471 |
+
-696,
|
| 472 |
+
865,
|
| 473 |
+
776,
|
| 474 |
+
117,
|
| 475 |
+
890,
|
| 476 |
+
627,
|
| 477 |
+
-135,
|
| 478 |
+
667,
|
| 479 |
+
-507,
|
| 480 |
+
-103,
|
| 481 |
+
34,
|
| 482 |
+
455,
|
| 483 |
+
-905,
|
| 484 |
+
-773,
|
| 485 |
+
90,
|
| 486 |
+
-340,
|
| 487 |
+
-606,
|
| 488 |
+
-129,
|
| 489 |
+
-215,
|
| 490 |
+
437,
|
| 491 |
+
-61,
|
| 492 |
+
308,
|
| 493 |
+
-264,
|
| 494 |
+
306,
|
| 495 |
+
-253,
|
| 496 |
+
-399,
|
| 497 |
+
-677,
|
| 498 |
+
912,
|
| 499 |
+
-274,
|
| 500 |
+
71
|
| 501 |
+
],
|
| 502 |
+
15
|
| 503 |
+
],
|
| 504 |
+
"output": false
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"input": [
|
| 508 |
+
[
|
| 509 |
+
188,
|
| 510 |
+
642,
|
| 511 |
+
-770,
|
| 512 |
+
-52,
|
| 513 |
+
-48,
|
| 514 |
+
858,
|
| 515 |
+
-237,
|
| 516 |
+
449,
|
| 517 |
+
-619,
|
| 518 |
+
40,
|
| 519 |
+
-469,
|
| 520 |
+
852,
|
| 521 |
+
836,
|
| 522 |
+
40,
|
| 523 |
+
-944,
|
| 524 |
+
-275,
|
| 525 |
+
69,
|
| 526 |
+
-951,
|
| 527 |
+
-455,
|
| 528 |
+
822,
|
| 529 |
+
-255,
|
| 530 |
+
417,
|
| 531 |
+
-139,
|
| 532 |
+
-546,
|
| 533 |
+
-978,
|
| 534 |
+
200,
|
| 535 |
+
378,
|
| 536 |
+
545,
|
| 537 |
+
306,
|
| 538 |
+
710,
|
| 539 |
+
617,
|
| 540 |
+
585,
|
| 541 |
+
-653,
|
| 542 |
+
463,
|
| 543 |
+
474,
|
| 544 |
+
732,
|
| 545 |
+
98,
|
| 546 |
+
541,
|
| 547 |
+
-47,
|
| 548 |
+
-23,
|
| 549 |
+
-550,
|
| 550 |
+
-972,
|
| 551 |
+
-50,
|
| 552 |
+
361,
|
| 553 |
+
675,
|
| 554 |
+
-365,
|
| 555 |
+
673,
|
| 556 |
+
-866,
|
| 557 |
+
-522,
|
| 558 |
+
-879,
|
| 559 |
+
752,
|
| 560 |
+
-893,
|
| 561 |
+
-458,
|
| 562 |
+
-673,
|
| 563 |
+
774,
|
| 564 |
+
-721,
|
| 565 |
+
498,
|
| 566 |
+
-212,
|
| 567 |
+
801,
|
| 568 |
+
654,
|
| 569 |
+
886,
|
| 570 |
+
-257,
|
| 571 |
+
489,
|
| 572 |
+
-367,
|
| 573 |
+
-57,
|
| 574 |
+
-155,
|
| 575 |
+
-139,
|
| 576 |
+
-693,
|
| 577 |
+
875,
|
| 578 |
+
299,
|
| 579 |
+
-426,
|
| 580 |
+
-566,
|
| 581 |
+
250,
|
| 582 |
+
-121,
|
| 583 |
+
677,
|
| 584 |
+
-65,
|
| 585 |
+
523,
|
| 586 |
+
439,
|
| 587 |
+
119,
|
| 588 |
+
407,
|
| 589 |
+
-715,
|
| 590 |
+
915,
|
| 591 |
+
674
|
| 592 |
+
],
|
| 593 |
+
38
|
| 594 |
+
],
|
| 595 |
+
"output": false
|
| 596 |
+
}
|
| 597 |
+
],
|
| 598 |
+
"haskell_template": "hasIncreasingSubarrays :: [Int] -> Int -> Bool\nhasIncreasingSubarrays nums k ",
|
| 599 |
+
"ocaml_template": "let hasIncreasingSubarrays (nums: int list) (k: int) : bool = ",
|
| 600 |
+
"scala_template": "def hasIncreasingSubarrays(nums: List[Int],k: Int): Boolean = { \n \n}",
|
| 601 |
+
"java_template": "class Solution {\n public boolean hasIncreasingSubarrays(List<Integer> nums, int k) {\n \n }\n}",
|
| 602 |
+
"python_template": "class Solution(object):\n def hasIncreasingSubarrays(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: bool\n \"\"\"\n "
|
| 603 |
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal true (hasIncreasingSubarrays [2;5;7;8;9;2;3;4;3;1] 3)
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal false (hasIncreasingSubarrays [1;2;3;4;4;4;4;5;6;7] 5)
|
| 14 |
+
|
| 15 |
+
let test3 _ = assert_equal false (hasIncreasingSubarrays [-669; 939; ( -671); ( -764); ( -122); 65; 433; ( -158); 532; ( -539); 634; ( -912); ( -271); 596; 397; 732; ( -474); 665; 518; 851; 3; 290; ( -172); ( -303); ( -856); 594; ( -99); 265; ( -948); ( -66); 381; ( -217); 765; 992; ( -799); ( -962); ( -359); ( -116); ( -737); ( -271); 441; 552; ( -845); ( -663); ( -415); 23; 987] 20)
|
| 16 |
+
|
| 17 |
+
let test4 _ = assert_equal false (hasIncreasingSubarrays [846; ( -627); 915; ( -300); ( -391); ( -505); 507] 2)
|
| 18 |
+
|
| 19 |
+
let test5 _ = assert_equal false (hasIncreasingSubarrays [871; ( -896); ( -232); 537; 464; 728; ( -10); ( -927); ( -539); ( -113); 928; 555; 775; ( -900); ( -289); 795; ( -849); 450; 253; 450; ( -308); ( -589); ( -563); 848; 119; ( -780); ( -381)] 5)
|
| 20 |
+
|
| 21 |
+
let test6 _ = assert_equal false (hasIncreasingSubarrays [0; ( -807); 367; 485; 105; 174; ( -444); ( -479); ( -440); ( -626); ( -645); 422; 608; 881; ( -2); 147; ( -796); ( -752); 799; ( -782); ( -281); ( -955); ( -700); ( -946); ( -175); 134; 738; ( -983); 441; 284; 545; ( -597); ( -168); ( -53); 702; ( -845); ( -34); 126; ( -351); 842; 257; 59; 821; ( -974); 546; ( -628); ( -55); ( -452); 203; ( -793); ( -251); ( -515); 284] 16)
|
| 22 |
+
|
| 23 |
+
let test7 _ = assert_equal false (hasIncreasingSubarrays [-256; ( -176); 324; ( -573); ( -964); ( -489); ( -141); 884; ( -44); 137; 492; 813; ( -442); 608; ( -455); 971; ( -200); 940; 772; 359; ( -886); ( -454); ( -148); ( -473); ( -344); 18; 292; 137; ( -893); 238; ( -706); 974; ( -980); ( -639); ( -51); 267] 6)
|
| 24 |
+
|
| 25 |
+
let test8 _ = assert_equal false (hasIncreasingSubarrays [-744; 380; 344; 139; 841; 750; 102; ( -653); ( -428); ( -138); 104; 987; 604; ( -83); ( -428); ( -414); 664; ( -601); 663; ( -907); 190; 180; 926; ( -533); ( -872)] 3)
|
| 26 |
+
|
| 27 |
+
let test9 _ = assert_equal false (hasIncreasingSubarrays [945; ( -656); 548; ( -31); 150; 186; 646; ( -910); 998; 336; 297; ( -267); 255; 748; ( -171); 488; ( -426); 826; ( -497); ( -228); 558; ( -875); 606; ( -372); ( -83); ( -63); ( -639); 195; 747; ( -795); ( -198); 102; 187; ( -546); ( -325); 414; 839; 890; 959; ( -581); ( -662); 365; 369; 12; ( -955); ( -657); ( -199); 56; ( -141); 382; ( -892); ( -461); 259; ( -574); ( -677); ( -211); ( -170); 889; ( -221); 462; 901; 291; 588; 863; 193; 376; ( -358); ( -677); 620; ( -717); 782; 813; ( -329); ( -424); ( -901)] 18)
|
| 28 |
+
|
| 29 |
+
let test10 _ = assert_equal true (hasIncreasingSubarrays [-344; 743; 491; 216; 42; ( -955); ( -472); ( -736); 582; ( -552); 814; 538; 35; ( -988); 971; 362; 227; ( -42); 709; ( -704); ( -529); ( -537); 172; 609; 217; ( -73); ( -444); 67; ( -820); ( -687); ( -158); 738; 605; 804; ( -779); 463; ( -677); 491; ( -459); ( -479); ( -856); 680; ( -499); ( -349); ( -864); ( -462); 359; 119; ( -916); 43; 699; ( -488); 325; 559; 487; 151; 595; 425; ( -785); 706; 390; 215; ( -883); ( -693); 446] 3)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
(* Grouping test cases *)
|
| 33 |
+
let suite = "Test Suite for hasIncreasingSubarrays" >::: [
|
| 34 |
+
|
| 35 |
+
"test1" >:: test1;
|
| 36 |
+
"test2" >:: test2;
|
| 37 |
+
"test3" >:: test3;
|
| 38 |
+
"test4" >:: test4;
|
| 39 |
+
"test5" >:: test5;
|
| 40 |
+
"test6" >:: test6;
|
| 41 |
+
"test7" >:: test7;
|
| 42 |
+
"test8" >:: test8;
|
| 43 |
+
"test9" >:: test9;
|
| 44 |
+
"test10" >:: test10;
|
| 45 |
+
]
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
(* Running the tests *)
|
| 49 |
+
let () = run_test_tt_main suite
|
| 50 |
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.hasIncreasingSubarrays(List(2,5,7,8,9,2,3,4,3,1),3), true)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.hasIncreasingSubarrays(List(1,2,3,4,4,4,4,5,6,7),5), false)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.hasIncreasingSubarrays(List(-669, 939, -671, -764, -122, 65, 433, -158, 532, -539, 634, -912, -271, 596, 397, 732, -474, 665, 518, 851, 3, 290, -172, -303, -856, 594, -99, 265, -948, -66, 381, -217, 765, 992, -799, -962, -359, -116, -737, -271, 441, 552, -845, -663, -415, 23, 987),20), false)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
test("test4") {
|
| 17 |
+
assertEquals(Main.hasIncreasingSubarrays(List(846, -627, 915, -300, -391, -505, 507),2), false)
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
test("test5") {
|
| 21 |
+
assertEquals(Main.hasIncreasingSubarrays(List(871, -896, -232, 537, 464, 728, -10, -927, -539, -113, 928, 555, 775, -900, -289, 795, -849, 450, 253, 450, -308, -589, -563, 848, 119, -780, -381),5), false)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
test("test6") {
|
| 25 |
+
assertEquals(Main.hasIncreasingSubarrays(List(0, -807, 367, 485, 105, 174, -444, -479, -440, -626, -645, 422, 608, 881, -2, 147, -796, -752, 799, -782, -281, -955, -700, -946, -175, 134, 738, -983, 441, 284, 545, -597, -168, -53, 702, -845, -34, 126, -351, 842, 257, 59, 821, -974, 546, -628, -55, -452, 203, -793, -251, -515, 284),16), false)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
test("test7") {
|
| 29 |
+
assertEquals(Main.hasIncreasingSubarrays(List(-256, -176, 324, -573, -964, -489, -141, 884, -44, 137, 492, 813, -442, 608, -455, 971, -200, 940, 772, 359, -886, -454, -148, -473, -344, 18, 292, 137, -893, 238, -706, 974, -980, -639, -51, 267),6), false)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
test("test8") {
|
| 33 |
+
assertEquals(Main.hasIncreasingSubarrays(List(-744, 380, 344, 139, 841, 750, 102, -653, -428, -138, 104, 987, 604, -83, -428, -414, 664, -601, 663, -907, 190, 180, 926, -533, -872),3), false)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
test("test9") {
|
| 37 |
+
assertEquals(Main.hasIncreasingSubarrays(List(945, -656, 548, -31, 150, 186, 646, -910, 998, 336, 297, -267, 255, 748, -171, 488, -426, 826, -497, -228, 558, -875, 606, -372, -83, -63, -639, 195, 747, -795, -198, 102, 187, -546, -325, 414, 839, 890, 959, -581, -662, 365, 369, 12, -955, -657, -199, 56, -141, 382, -892, -461, 259, -574, -677, -211, -170, 889, -221, 462, 901, 291, 588, 863, 193, 376, -358, -677, 620, -717, 782, 813, -329, -424, -901),18), false)
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
test("test10") {
|
| 41 |
+
assertEquals(Main.hasIncreasingSubarrays(List(-344, 743, 491, 216, 42, -955, -472, -736, 582, -552, 814, 538, 35, -988, 971, 362, 227, -42, 709, -704, -529, -537, 172, 609, 217, -73, -444, 67, -820, -687, -158, 738, 605, 804, -779, 463, -677, 491, -459, -479, -856, 680, -499, -349, -864, -462, 359, 119, -916, 43, 699, -488, 325, 559, 487, 151, 595, 425, -785, 706, 390, 215, -883, -693, 446),3), true)
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (flowerGame 3 2)," 3 (flowerGame 3 2))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (flowerGame 1 1)," 0 (flowerGame 1 1))
|
| 16 |
+
|
| 17 |
+
test3 :: Test
|
| 18 |
+
test3 = TestCase (assertEqual "for (flowerGame 76449 82807)," 3165256171 (flowerGame 76449 82807))
|
| 19 |
+
|
| 20 |
+
test4 :: Test
|
| 21 |
+
test4 = TestCase (assertEqual "for (flowerGame 37149 7947)," 147611551 (flowerGame 37149 7947))
|
| 22 |
+
|
| 23 |
+
test5 :: Test
|
| 24 |
+
test5 = TestCase (assertEqual "for (flowerGame 65876 54651)," 1800094638 (flowerGame 65876 54651))
|
| 25 |
+
|
| 26 |
+
test6 :: Test
|
| 27 |
+
test6 = TestCase (assertEqual "for (flowerGame 83462 43930)," 1833242830 (flowerGame 83462 43930))
|
| 28 |
+
|
| 29 |
+
test7 :: Test
|
| 30 |
+
test7 = TestCase (assertEqual "for (flowerGame 85778 70262)," 3013466918 (flowerGame 85778 70262))
|
| 31 |
+
|
| 32 |
+
test8 :: Test
|
| 33 |
+
test8 = TestCase (assertEqual "for (flowerGame 85146 43396)," 1847497908 (flowerGame 85146 43396))
|
| 34 |
+
|
| 35 |
+
test9 :: Test
|
| 36 |
+
test9 = TestCase (assertEqual "for (flowerGame 31445 22823)," 358834617 (flowerGame 31445 22823))
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
-- Grouping test cases
|
| 40 |
+
tests :: Test
|
| 41 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6, TestLabel "Test7" test7, TestLabel "Test8" test8, TestLabel "Test9" test9]
|
| 42 |
+
|
| 43 |
+
-- Running the tests
|
| 44 |
+
main :: IO Counts
|
| 45 |
+
main = runTestTT tests
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(3, flowerGame(3, 2));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(0, flowerGame(1, 1));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 3279,
|
| 3 |
+
"name": "alice_and_bob_playing_flower_game",
|
| 4 |
+
"difficulty": "Medium",
|
| 5 |
+
"link": "https://leetcode.com/problems/alice-and-bob-playing-flower-game/",
|
| 6 |
+
"date": "2024-01-21 00:00:00",
|
| 7 |
+
"task_description": "Alice and Bob are playing a turn-based game on a circular field surrounded by flowers. The circle represents the field, and there are `x` flowers in the clockwise direction between Alice and Bob, and `y` flowers in the anti-clockwise direction between them. The game proceeds as follows: Alice takes the first turn. In each turn, a player must choose either the clockwise or anti-clockwise direction and pick one flower from that side. At the end of the turn, if there are no flowers left at all, the **current** player captures their opponent and wins the game. Given two integers, `n` and `m`, the task is to compute the number of possible pairs `(x, y)` that satisfy the conditions: Alice must win the game according to the described rules. The number of flowers `x` in the clockwise direction must be in the range `[1,n]`. The number of flowers `y` in the anti-clockwise direction must be in the range `[1,m]`. Return _the number of possible pairs_ `(x, y)` _that satisfy the conditions mentioned in the statement_. **Example 1:** ``` **Input:** n = 3, m = 2 **Output:** 3 **Explanation:** The following pairs satisfy conditions described in the statement: (1,2), (3,2), (2,1). ``` **Example 2:** ``` **Input:** n = 1, m = 1 **Output:** 0 **Explanation:** No pairs satisfy the conditions described in the statement. ``` **Constraints:** `1 <= n, m <= 105`",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "n = 3, m = 2",
|
| 12 |
+
"output": "3 "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "n = 1, m = 1",
|
| 17 |
+
"output": "0 "
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"private_test_cases": [
|
| 21 |
+
{
|
| 22 |
+
"input": [
|
| 23 |
+
76449,
|
| 24 |
+
82807
|
| 25 |
+
],
|
| 26 |
+
"output": 3165256171
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"input": [
|
| 30 |
+
37149,
|
| 31 |
+
7947
|
| 32 |
+
],
|
| 33 |
+
"output": 147611551
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"input": [
|
| 37 |
+
65876,
|
| 38 |
+
54651
|
| 39 |
+
],
|
| 40 |
+
"output": 1800094638
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"input": [
|
| 44 |
+
83462,
|
| 45 |
+
43930
|
| 46 |
+
],
|
| 47 |
+
"output": 1833242830
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"input": [
|
| 51 |
+
85778,
|
| 52 |
+
70262
|
| 53 |
+
],
|
| 54 |
+
"output": 3013466918
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"input": [
|
| 58 |
+
85146,
|
| 59 |
+
43396
|
| 60 |
+
],
|
| 61 |
+
"output": 1847497908
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"input": [
|
| 65 |
+
31445,
|
| 66 |
+
22823
|
| 67 |
+
],
|
| 68 |
+
"output": 358834617
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"input": [
|
| 72 |
+
15704,
|
| 73 |
+
32979
|
| 74 |
+
],
|
| 75 |
+
"output": 258951108
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"input": [
|
| 79 |
+
74462,
|
| 80 |
+
73807
|
| 81 |
+
],
|
| 82 |
+
"output": 2747908417
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"input": [
|
| 86 |
+
53354,
|
| 87 |
+
74360
|
| 88 |
+
],
|
| 89 |
+
"output": 1983701720
|
| 90 |
+
}
|
| 91 |
+
],
|
| 92 |
+
"haskell_template": "flowerGame :: Int -> Int -> Int\nflowerGame n m ",
|
| 93 |
+
"ocaml_template": "let flowerGame (n: int) (m: int) : int = ",
|
| 94 |
+
"scala_template": "def flowerGame(n: Int,m: Int): Int = { \n \n}",
|
| 95 |
+
"java_template": "class Solution {\n public long flowerGame(int n, int m) {\n \n }\n}",
|
| 96 |
+
"python_template": "class Solution(object):\n def flowerGame(self, n, m):\n \"\"\"\n :type n: int\n :type m: int\n :rtype: int\n \"\"\"\n "
|
| 97 |
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal 3 (flowerGame 3 2)
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal 0 (flowerGame 1 1)
|
| 14 |
+
|
| 15 |
+
let test3 _ = assert_equal 3165256171 (flowerGame 76449 82807)
|
| 16 |
+
|
| 17 |
+
let test4 _ = assert_equal 147611551 (flowerGame 37149 7947)
|
| 18 |
+
|
| 19 |
+
let test5 _ = assert_equal 1800094638 (flowerGame 65876 54651)
|
| 20 |
+
|
| 21 |
+
let test6 _ = assert_equal 1833242830 (flowerGame 83462 43930)
|
| 22 |
+
|
| 23 |
+
let test7 _ = assert_equal 3013466918 (flowerGame 85778 70262)
|
| 24 |
+
|
| 25 |
+
let test8 _ = assert_equal 1847497908 (flowerGame 85146 43396)
|
| 26 |
+
|
| 27 |
+
let test9 _ = assert_equal 358834617 (flowerGame 31445 22823)
|
| 28 |
+
|
| 29 |
+
let test10 _ = assert_equal 258951108 (flowerGame 15704 32979)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
(* Grouping test cases *)
|
| 33 |
+
let suite = "Test Suite for flowerGame" >::: [
|
| 34 |
+
|
| 35 |
+
"test1" >:: test1;
|
| 36 |
+
"test2" >:: test2;
|
| 37 |
+
"test3" >:: test3;
|
| 38 |
+
"test4" >:: test4;
|
| 39 |
+
"test5" >:: test5;
|
| 40 |
+
"test6" >:: test6;
|
| 41 |
+
"test7" >:: test7;
|
| 42 |
+
"test8" >:: test8;
|
| 43 |
+
"test9" >:: test9;
|
| 44 |
+
"test10" >:: test10;
|
| 45 |
+
]
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
(* Running the tests *)
|
| 49 |
+
let () = run_test_tt_main suite
|
| 50 |
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.flowerGame(3,2), 3)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.flowerGame(1,1), 0)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.flowerGame(76449,82807), BigInt("3165256171"))
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
test("test4") {
|
| 17 |
+
assertEquals(Main.flowerGame(37149,7947), 147611551)
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
test("test5") {
|
| 21 |
+
assertEquals(Main.flowerGame(65876,54651), 1800094638)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
test("test6") {
|
| 25 |
+
assertEquals(Main.flowerGame(83462,43930), 1833242830)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
test("test7") {
|
| 29 |
+
assertEquals(Main.flowerGame(85778,70262), BigInt("3013466918"))
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
test("test8") {
|
| 33 |
+
assertEquals(Main.flowerGame(85146,43396), 1847497908)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
test("test9") {
|
| 37 |
+
assertEquals(Main.flowerGame(31445,22823), 358834617)
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
test("test10") {
|
| 41 |
+
assertEquals(Main.flowerGame(15704,32979), 258951108)
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
}
|
|
Binary file (6.15 kB). View file
|
|
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (maxScoreIndices [0,0,1,0])," [2,4] (maxScoreIndices [0,0,1,0]))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (maxScoreIndices [0,0,0])," [3] (maxScoreIndices [0,0,0]))
|
| 16 |
+
|
| 17 |
+
test3 :: Test
|
| 18 |
+
test3 = TestCase (assertEqual "for (maxScoreIndices [1,1])," [0] (maxScoreIndices [1,1]))
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
-- Grouping test cases
|
| 22 |
+
tests :: Test
|
| 23 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
|
| 24 |
+
|
| 25 |
+
-- Running the tests
|
| 26 |
+
main :: IO Counts
|
| 27 |
+
main = runTestTT tests
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(new ArrayList<>(Arrays.asList(2,4)), maxScoreIndices(new ArrayList<>(Arrays.asList(0,0,1,0))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(new ArrayList<>(Arrays.asList(3)), maxScoreIndices(new ArrayList<>(Arrays.asList(0,0,0))));
|
| 19 |
+
}
|
| 20 |
+
@Test
|
| 21 |
+
public void test3() {
|
| 22 |
+
assertEquals(new ArrayList<>(Arrays.asList(0)), maxScoreIndices(new ArrayList<>(Arrays.asList(1,1))));
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:caa21b2b9270e6fba599ae2a4f0386444b2dd465a5a98e9c14689194513427cb
|
| 3 |
+
size 11483445
|
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal [2;4] (maxScoreIndices [0;0;1;0])
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal [3] (maxScoreIndices [0;0;0])
|
| 14 |
+
|
| 15 |
+
let test3 _ = assert_equal [0] (maxScoreIndices [1;1])
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
(* Grouping test cases *)
|
| 19 |
+
let suite = "Test Suite for maxScoreIndices" >::: [
|
| 20 |
+
|
| 21 |
+
"test1" >:: test1;
|
| 22 |
+
"test2" >:: test2;
|
| 23 |
+
"test3" >:: test3;
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
(* Running the tests *)
|
| 28 |
+
let () = run_test_tt_main suite
|
| 29 |
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.maxScoreIndices(List(0,0,1,0)), List(2,4))
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.maxScoreIndices(List(0,0,0)), List(3))
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.maxScoreIndices(List(1,1)), List(0))
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
numberOfAlternatingGroups :: [Int] -> Int
|
| 7 |
+
numberOfAlternatingGroups colors = undefined
|
| 8 |
+
|
| 9 |
+
--Program end
|
| 10 |
+
|
| 11 |
+
-- Test cases
|
| 12 |
+
|
| 13 |
+
test1 :: Test
|
| 14 |
+
test1 = TestCase (assertEqual "for (numberOfAlternatingGroups [1,1,1])," 0 (numberOfAlternatingGroups [1,1,1]))
|
| 15 |
+
|
| 16 |
+
test2 :: Test
|
| 17 |
+
test2 = TestCase (assertEqual "for (numberOfAlternatingGroups [0,1,0,0,1])," 3 (numberOfAlternatingGroups [0,1,0,0,1]))
|
| 18 |
+
|
| 19 |
+
test3 :: Test
|
| 20 |
+
test3 = TestCase (assertEqual "for (numberOfAlternatingGroups [1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0])," 11 (numberOfAlternatingGroups [1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0]))
|
| 21 |
+
|
| 22 |
+
test4 :: Test
|
| 23 |
+
test4 = TestCase (assertEqual "for (numberOfAlternatingGroups [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1])," 30 (numberOfAlternatingGroups [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1]))
|
| 24 |
+
|
| 25 |
+
test5 :: Test
|
| 26 |
+
test5 = TestCase (assertEqual "for (numberOfAlternatingGroups [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1])," 5 (numberOfAlternatingGroups [1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1]))
|
| 27 |
+
|
| 28 |
+
test6 :: Test
|
| 29 |
+
test6 = TestCase (assertEqual "for (numberOfAlternatingGroups [1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0])," 19 (numberOfAlternatingGroups [1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0]))
|
| 30 |
+
|
| 31 |
+
test7 :: Test
|
| 32 |
+
test7 = TestCase (assertEqual "for (numberOfAlternatingGroups [0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0])," 11 (numberOfAlternatingGroups [0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0]))
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
-- Grouping test cases
|
| 36 |
+
tests :: Test
|
| 37 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
|
| 38 |
+
|
| 39 |
+
-- Running the tests
|
| 40 |
+
main :: IO Counts
|
| 41 |
+
main = runTestTT tests
|
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
public class Main {
|
| 7 |
+
//Program start
|
| 8 |
+
|
| 9 |
+
//Program end
|
| 10 |
+
|
| 11 |
+
@Test
|
| 12 |
+
public void test1() {
|
| 13 |
+
assertEquals(0, numberOfAlternatingGroups(Arrays.asList(1,1,1)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(3, numberOfAlternatingGroups(Arrays.asList(0,1,0,0,1)));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 3463,
|
| 3 |
+
"name": "alternating_groups_i",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/alternating-groups-i/",
|
| 6 |
+
"date": "2024-06-22 00:00:00",
|
| 7 |
+
"task_description": "There is a circle of red and blue tiles. You are given an array of integers `colors`. The color of tile `i` is represented by `colors[i]`: `colors[i] == 0` means that tile `i` is **red**. `colors[i] == 1` means that tile `i` is **blue**. Every 3 contiguous tiles in the circle with **alternating** colors (the middle tile has a different color from its **left** and **right** tiles) is called an **alternating** group. Return the number of **alternating** groups. **Note** that since `colors` represents a **circle**, the **first** and the **last** tiles are considered to be next to each other. **Example 1:** **Input:** colors = [1,1,1] **Output:** 0 **Explanation:** **Example 2:** **Input:** colors = [0,1,0,0,1] **Output:** 3 **Explanation:** Alternating groups: ******** **Constraints:** `3 <= colors.length <= 100` `0 <= colors[i] <= 1`",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "colors = [1,1,1]",
|
| 12 |
+
"output": "0 "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "colors = [0,1,0,0,1]",
|
| 17 |
+
"output": "3 "
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"private_test_cases": [
|
| 21 |
+
{
|
| 22 |
+
"input": [
|
| 23 |
+
1,
|
| 24 |
+
0,
|
| 25 |
+
1,
|
| 26 |
+
1,
|
| 27 |
+
0,
|
| 28 |
+
0,
|
| 29 |
+
0,
|
| 30 |
+
1,
|
| 31 |
+
1,
|
| 32 |
+
0,
|
| 33 |
+
0,
|
| 34 |
+
1,
|
| 35 |
+
0,
|
| 36 |
+
1,
|
| 37 |
+
0,
|
| 38 |
+
0,
|
| 39 |
+
1,
|
| 40 |
+
1,
|
| 41 |
+
0,
|
| 42 |
+
0,
|
| 43 |
+
1,
|
| 44 |
+
0,
|
| 45 |
+
0,
|
| 46 |
+
0,
|
| 47 |
+
0,
|
| 48 |
+
0,
|
| 49 |
+
1,
|
| 50 |
+
0,
|
| 51 |
+
1,
|
| 52 |
+
0,
|
| 53 |
+
1,
|
| 54 |
+
0,
|
| 55 |
+
0
|
| 56 |
+
],
|
| 57 |
+
"output": 11
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"input": [
|
| 61 |
+
0,
|
| 62 |
+
1,
|
| 63 |
+
0,
|
| 64 |
+
1,
|
| 65 |
+
1,
|
| 66 |
+
1,
|
| 67 |
+
1,
|
| 68 |
+
1,
|
| 69 |
+
1,
|
| 70 |
+
1,
|
| 71 |
+
0,
|
| 72 |
+
0,
|
| 73 |
+
0,
|
| 74 |
+
1,
|
| 75 |
+
1,
|
| 76 |
+
1,
|
| 77 |
+
1,
|
| 78 |
+
1,
|
| 79 |
+
1,
|
| 80 |
+
1,
|
| 81 |
+
0,
|
| 82 |
+
1,
|
| 83 |
+
0,
|
| 84 |
+
0,
|
| 85 |
+
1,
|
| 86 |
+
0,
|
| 87 |
+
1,
|
| 88 |
+
0,
|
| 89 |
+
0,
|
| 90 |
+
1,
|
| 91 |
+
1,
|
| 92 |
+
0,
|
| 93 |
+
1,
|
| 94 |
+
0,
|
| 95 |
+
0,
|
| 96 |
+
0,
|
| 97 |
+
0,
|
| 98 |
+
0,
|
| 99 |
+
1,
|
| 100 |
+
0,
|
| 101 |
+
1,
|
| 102 |
+
0,
|
| 103 |
+
0,
|
| 104 |
+
1,
|
| 105 |
+
0,
|
| 106 |
+
0,
|
| 107 |
+
1,
|
| 108 |
+
1,
|
| 109 |
+
1,
|
| 110 |
+
1,
|
| 111 |
+
0,
|
| 112 |
+
1,
|
| 113 |
+
0,
|
| 114 |
+
1,
|
| 115 |
+
0,
|
| 116 |
+
0,
|
| 117 |
+
0,
|
| 118 |
+
1,
|
| 119 |
+
0,
|
| 120 |
+
0,
|
| 121 |
+
1,
|
| 122 |
+
1,
|
| 123 |
+
1,
|
| 124 |
+
1,
|
| 125 |
+
1,
|
| 126 |
+
1,
|
| 127 |
+
0,
|
| 128 |
+
1,
|
| 129 |
+
1,
|
| 130 |
+
1,
|
| 131 |
+
0,
|
| 132 |
+
1,
|
| 133 |
+
1,
|
| 134 |
+
1,
|
| 135 |
+
1,
|
| 136 |
+
1,
|
| 137 |
+
1,
|
| 138 |
+
1,
|
| 139 |
+
0,
|
| 140 |
+
1,
|
| 141 |
+
0,
|
| 142 |
+
1,
|
| 143 |
+
0,
|
| 144 |
+
1,
|
| 145 |
+
1,
|
| 146 |
+
1,
|
| 147 |
+
0,
|
| 148 |
+
1,
|
| 149 |
+
0,
|
| 150 |
+
1,
|
| 151 |
+
1,
|
| 152 |
+
1,
|
| 153 |
+
1,
|
| 154 |
+
0,
|
| 155 |
+
1,
|
| 156 |
+
1
|
| 157 |
+
],
|
| 158 |
+
"output": 30
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"input": [
|
| 162 |
+
1,
|
| 163 |
+
0,
|
| 164 |
+
0,
|
| 165 |
+
0,
|
| 166 |
+
0,
|
| 167 |
+
0,
|
| 168 |
+
1,
|
| 169 |
+
0,
|
| 170 |
+
1,
|
| 171 |
+
0,
|
| 172 |
+
1,
|
| 173 |
+
1,
|
| 174 |
+
0,
|
| 175 |
+
0,
|
| 176 |
+
0,
|
| 177 |
+
0,
|
| 178 |
+
1,
|
| 179 |
+
1,
|
| 180 |
+
1,
|
| 181 |
+
0,
|
| 182 |
+
0,
|
| 183 |
+
1,
|
| 184 |
+
0,
|
| 185 |
+
0,
|
| 186 |
+
1,
|
| 187 |
+
1,
|
| 188 |
+
0,
|
| 189 |
+
0,
|
| 190 |
+
1,
|
| 191 |
+
1
|
| 192 |
+
],
|
| 193 |
+
"output": 5
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"input": [
|
| 197 |
+
1,
|
| 198 |
+
1,
|
| 199 |
+
0,
|
| 200 |
+
0,
|
| 201 |
+
1,
|
| 202 |
+
0,
|
| 203 |
+
1,
|
| 204 |
+
0,
|
| 205 |
+
0,
|
| 206 |
+
1,
|
| 207 |
+
0,
|
| 208 |
+
0,
|
| 209 |
+
1,
|
| 210 |
+
1,
|
| 211 |
+
1,
|
| 212 |
+
1,
|
| 213 |
+
0,
|
| 214 |
+
1,
|
| 215 |
+
1,
|
| 216 |
+
0,
|
| 217 |
+
1,
|
| 218 |
+
1,
|
| 219 |
+
0,
|
| 220 |
+
1,
|
| 221 |
+
1,
|
| 222 |
+
1,
|
| 223 |
+
0,
|
| 224 |
+
1,
|
| 225 |
+
0,
|
| 226 |
+
0,
|
| 227 |
+
1,
|
| 228 |
+
0,
|
| 229 |
+
1,
|
| 230 |
+
1,
|
| 231 |
+
0,
|
| 232 |
+
0,
|
| 233 |
+
1,
|
| 234 |
+
0,
|
| 235 |
+
1,
|
| 236 |
+
0,
|
| 237 |
+
1,
|
| 238 |
+
1,
|
| 239 |
+
1,
|
| 240 |
+
1,
|
| 241 |
+
1,
|
| 242 |
+
0,
|
| 243 |
+
0,
|
| 244 |
+
1,
|
| 245 |
+
0,
|
| 246 |
+
1,
|
| 247 |
+
1,
|
| 248 |
+
0,
|
| 249 |
+
0,
|
| 250 |
+
0,
|
| 251 |
+
0,
|
| 252 |
+
0,
|
| 253 |
+
1,
|
| 254 |
+
1,
|
| 255 |
+
1,
|
| 256 |
+
0,
|
| 257 |
+
0,
|
| 258 |
+
1,
|
| 259 |
+
0,
|
| 260 |
+
0,
|
| 261 |
+
1,
|
| 262 |
+
1,
|
| 263 |
+
1,
|
| 264 |
+
0
|
| 265 |
+
],
|
| 266 |
+
"output": 19
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
"input": [
|
| 270 |
+
0,
|
| 271 |
+
1,
|
| 272 |
+
0,
|
| 273 |
+
0,
|
| 274 |
+
1,
|
| 275 |
+
1,
|
| 276 |
+
1,
|
| 277 |
+
1,
|
| 278 |
+
0,
|
| 279 |
+
1,
|
| 280 |
+
0,
|
| 281 |
+
1,
|
| 282 |
+
1,
|
| 283 |
+
1,
|
| 284 |
+
0,
|
| 285 |
+
0,
|
| 286 |
+
1,
|
| 287 |
+
0,
|
| 288 |
+
0,
|
| 289 |
+
0,
|
| 290 |
+
1,
|
| 291 |
+
1,
|
| 292 |
+
0,
|
| 293 |
+
1,
|
| 294 |
+
0,
|
| 295 |
+
0,
|
| 296 |
+
1,
|
| 297 |
+
1,
|
| 298 |
+
1,
|
| 299 |
+
1,
|
| 300 |
+
1,
|
| 301 |
+
1,
|
| 302 |
+
0,
|
| 303 |
+
1,
|
| 304 |
+
1,
|
| 305 |
+
0,
|
| 306 |
+
0,
|
| 307 |
+
0,
|
| 308 |
+
1,
|
| 309 |
+
1,
|
| 310 |
+
0,
|
| 311 |
+
1,
|
| 312 |
+
0,
|
| 313 |
+
0,
|
| 314 |
+
0,
|
| 315 |
+
0,
|
| 316 |
+
1,
|
| 317 |
+
1,
|
| 318 |
+
0,
|
| 319 |
+
0,
|
| 320 |
+
0,
|
| 321 |
+
0,
|
| 322 |
+
1,
|
| 323 |
+
0
|
| 324 |
+
],
|
| 325 |
+
"output": 11
|
| 326 |
+
}
|
| 327 |
+
],
|
| 328 |
+
"haskell_template": "numberOfAlternatingGroups :: [Int] -> Int\nnumberOfAlternatingGroups colors ",
|
| 329 |
+
"ocaml_template": "let numberOfAlternatingGroups (colors: int list) : int = ",
|
| 330 |
+
"scala_template": "def numberOfAlternatingGroups(colors: List[Int]): Int = { \n \n}",
|
| 331 |
+
"java_template": "class Solution {\n public int numberOfAlternatingGroups(int[] colors) {\n \n }\n}",
|
| 332 |
+
"python_template": "class Solution(object):\n def numberOfAlternatingGroups(self, colors):\n \"\"\"\n :type colors: List[int]\n :rtype: int\n \"\"\"\n "
|
| 333 |
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
let numberOfAlternatingGroups (colors: int list) : int = failwith "Not implemented"
|
| 7 |
+
|
| 8 |
+
(* Program end *)
|
| 9 |
+
|
| 10 |
+
(* Test cases *)
|
| 11 |
+
|
| 12 |
+
let test1 _ = assert_equal 0 (numberOfAlternatingGroups [1;1;1])
|
| 13 |
+
|
| 14 |
+
let test2 _ = assert_equal 3 (numberOfAlternatingGroups [0;1;0;0;1])
|
| 15 |
+
|
| 16 |
+
let test3 _ = assert_equal 3 (numberOfAlternatingGroups [1; 0; 1; 1; 0; 0; 0; 1; 1; 0; 0; 1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 0; 0; 0; 0; 1; 0; 1; 0; 1; 0; 0])
|
| 17 |
+
|
| 18 |
+
let test4 _ = assert_equal 3 (numberOfAlternatingGroups [0; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 0; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1; 0; 0; 1; 0; 1; 0; 0; 1; 1; 0; 1; 0; 0; 0; 0; 0; 1; 0; 1; 0; 0; 1; 0; 0; 1; 1; 1; 1; 0; 1; 0; 1; 0; 0; 0; 1; 0; 0; 1; 1; 1; 1; 1; 1; 0; 1; 1; 1; 0; 1; 1; 1; 1; 1; 1; 1; 0; 1; 0; 1; 0; 1; 1; 1; 0; 1; 0; 1; 1; 1; 1; 0; 1; 1])
|
| 19 |
+
|
| 20 |
+
let test5 _ = assert_equal 3 (numberOfAlternatingGroups [1; 0; 0; 0; 0; 0; 1; 0; 1; 0; 1; 1; 0; 0; 0; 0; 1; 1; 1; 0; 0; 1; 0; 0; 1; 1; 0; 0; 1; 1])
|
| 21 |
+
|
| 22 |
+
let test6 _ = assert_equal 3 (numberOfAlternatingGroups [1; 1; 0; 0; 1; 0; 1; 0; 0; 1; 0; 0; 1; 1; 1; 1; 0; 1; 1; 0; 1; 1; 0; 1; 1; 1; 0; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 0; 1; 0; 1; 1; 1; 1; 1; 0; 0; 1; 0; 1; 1; 0; 0; 0; 0; 0; 1; 1; 1; 0; 0; 1; 0; 0; 1; 1; 1; 0])
|
| 23 |
+
|
| 24 |
+
let test7 _ = assert_equal 3 (numberOfAlternatingGroups [0; 1; 0; 0; 1; 1; 1; 1; 0; 1; 0; 1; 1; 1; 0; 0; 1; 0; 0; 0; 1; 1; 0; 1; 0; 0; 1; 1; 1; 1; 1; 1; 0; 1; 1; 0; 0; 0; 1; 1; 0; 1; 0; 0; 0; 0; 1; 1; 0; 0; 0; 0; 1; 0])
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
(* Grouping test cases *)
|
| 28 |
+
let suite = "Test Suite for numberOfAlternatingGroups" >::: [
|
| 29 |
+
|
| 30 |
+
"test1" >:: test1;
|
| 31 |
+
"test2" >:: test2;
|
| 32 |
+
"test3" >:: test3;
|
| 33 |
+
"test4" >:: test4;
|
| 34 |
+
"test5" >:: test5;
|
| 35 |
+
"test6" >:: test6;
|
| 36 |
+
"test7" >:: test7;
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
(* Running the tests *)
|
| 41 |
+
let () = run_test_tt_main suite
|
| 42 |
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.numberOfAlternatingGroups(List(1,1,1)), 0)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.numberOfAlternatingGroups(List(0,1,0,0,1)), 3)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.numberOfAlternatingGroups(1,0,1,1,0,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0), 11)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
test("test4") {
|
| 17 |
+
assertEquals(Main.numberOfAlternatingGroups(0,1,0,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,0,1,1), 30)
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
test("test5") {
|
| 21 |
+
assertEquals(Main.numberOfAlternatingGroups(1,0,0,0,0,0,1,0,1,0,1,1,0,0,0,0,1,1,1,0,0,1,0,0,1,1,0,0,1,1), 5)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
test("test6") {
|
| 25 |
+
assertEquals(Main.numberOfAlternatingGroups(1,1,0,0,1,0,1,0,0,1,0,0,1,1,1,1,0,1,1,0,1,1,0,1,1,1,0,1,0,0,1,0,1,1,0,0,1,0,1,0,1,1,1,1,1,0,0,1,0,1,1,0,0,0,0,0,1,1,1,0,0,1,0,0,1,1,1,0), 19)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
test("test7") {
|
| 29 |
+
assertEquals(Main.numberOfAlternatingGroups(0,1,0,0,1,1,1,1,0,1,0,1,1,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1,1,1,1,1,0,1,1,0,0,0,1,1,0,1,0,0,0,0,1,1,0,0,0,0,1,0), 11)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
}
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(3, numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,1,0,1,0)), 3));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(2, numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,1,0,0,1,0,1)), 6));
|
| 19 |
+
}
|
| 20 |
+
@Test
|
| 21 |
+
public void test3() {
|
| 22 |
+
assertEquals(0, numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(1,1,0,1)), 4));
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(new ArrayList<>(Arrays.asList(2)), numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,1,1,0,1)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(2,1,0)),new ArrayList<>(Arrays.asList(1,4))))));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(new ArrayList<>(Arrays.asList(2,0)), numberOfAlternatingGroups(new ArrayList<>(Arrays.asList(0,0,1,0,1,1)), new ArrayList<>(Arrays.asList(new ArrayList<>(Arrays.asList(1,3)),new ArrayList<>(Arrays.asList(2,3,0)),new ArrayList<>(Arrays.asList(1,5))))));
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2dfb4ad6017e4522029cc12f97ed5a3d68568525e67cbcf6dcd9bb2e2cb3818
|
| 3 |
+
size 17190671
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
returnToBoundaryCount :: [Int] -> Int
|
| 7 |
+
returnToBoundaryCount nums = undefined
|
| 8 |
+
|
| 9 |
+
--Program end
|
| 10 |
+
|
| 11 |
+
-- Test cases
|
| 12 |
+
|
| 13 |
+
test1 :: Test
|
| 14 |
+
test1 = TestCase (assertEqual "for (returnToBoundaryCount [2,3,-5])," 1 (returnToBoundaryCount [2,3,-5]))
|
| 15 |
+
|
| 16 |
+
test2 :: Test
|
| 17 |
+
test2 = TestCase (assertEqual "for (returnToBoundaryCount [3,2,-3,-4])," 0 (returnToBoundaryCount [3,2,-3,-4]))
|
| 18 |
+
|
| 19 |
+
test3 :: Test
|
| 20 |
+
test3 = TestCase (assertEqual "for (returnToBoundaryCount [-10, 9, ( -10), 10, 1, ( -8), 5, 9, ( -7), ( -9), 2, ( -8), ( -1), ( -5), ( -7), 7, ( -5), ( -2), ( -3), 9, ( -9), ( -9), 9, ( -3), ( -7), ( -6), ( -9), ( -7), 0, 4, ( -1), ( -10), 0, 8, 8, ( -7), ( -1), 3, 8, ( -3), ( -1), ( -6)])," 1 (returnToBoundaryCount [-10, 9, -10, 10, 1, -8, 5, 9, -7, -9, 2, -8, -1, -5, -7, 7, -5, -2, -3, 9, -9, -9, 9, -3, -7, -6, -9, -7, 0, 4, -1, -10, 0, 8, 8, -7, -1, 3, 8, -3, -1, -6]))
|
| 21 |
+
|
| 22 |
+
test4 :: Test
|
| 23 |
+
test4 = TestCase (assertEqual "for (returnToBoundaryCount [-6, 0, 7, ( -4), ( -2), 5, 3, 4, 3, ( -7), 4, ( -6), 7, 8, ( -1), 5, 1, 10, ( -7), ( -6), 1, ( -5), 3, 8, ( -6), 5, ( -8), 10, ( -4), 3, ( -10), ( -3), ( -1), 10, 9, 10, ( -9), 10, ( -3), ( -3), ( -6), 0, 7, 4, 2, 0, 7, 2, ( -6)])," 1 (returnToBoundaryCount [-6, 0, 7, -4, -2, 5, 3, 4, 3, -7, 4, -6, 7, 8, -1, 5, 1, 10, -7, -6, 1, -5, 3, 8, -6, 5, -8, 10, -4, 3, -10, -3, -1, 10, 9, 10, -9, 10, -3, -3, -6, 0, 7, 4, 2, 0, 7, 2, -6]))
|
| 24 |
+
|
| 25 |
+
test5 :: Test
|
| 26 |
+
test5 = TestCase (assertEqual "for (returnToBoundaryCount [-2, 5, 1, ( -2), 7, ( -6), 6, 2, ( -2), ( -10), 10, 8, ( -3), 6])," 0 (returnToBoundaryCount [-2, 5, 1, -2, 7, -6, 6, 2, -2, -10, 10, 8, -3, 6]))
|
| 27 |
+
|
| 28 |
+
test6 :: Test
|
| 29 |
+
test6 = TestCase (assertEqual "for (returnToBoundaryCount [-2, ( -7), ( -7), ( -10), ( -10)])," 0 (returnToBoundaryCount [-2, -7, -7, -10, -10]))
|
| 30 |
+
|
| 31 |
+
test7 :: Test
|
| 32 |
+
test7 = TestCase (assertEqual "for (returnToBoundaryCount [-10, ( -9), 0])," 0 (returnToBoundaryCount [-10, -9, 0]))
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
-- Grouping test cases
|
| 36 |
+
tests :: Test
|
| 37 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2, TestLabel "Test3" test3, TestLabel "Test4" test4, TestLabel "Test5" test5, TestLabel "Test6" test6]
|
| 38 |
+
|
| 39 |
+
-- Running the tests
|
| 40 |
+
main :: IO Counts
|
| 41 |
+
main = runTestTT tests
|
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
public class Main {
|
| 7 |
+
//Program start
|
| 8 |
+
|
| 9 |
+
//Program end
|
| 10 |
+
|
| 11 |
+
@Test
|
| 12 |
+
public void test1() {
|
| 13 |
+
assertEquals(1, returnToBoundaryCount(Arrays.asList(2,3,-5)));
|
| 14 |
+
}
|
| 15 |
+
@Test
|
| 16 |
+
public void test2() {
|
| 17 |
+
assertEquals(0, returnToBoundaryCount(Arrays.asList(3,2,-3,-4)));
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": 3311,
|
| 3 |
+
"name": "ant_on_the_boundary",
|
| 4 |
+
"difficulty": "Easy",
|
| 5 |
+
"link": "https://leetcode.com/problems/ant-on-the-boundary/",
|
| 6 |
+
"date": "2024-01-28 00:00:00",
|
| 7 |
+
"task_description": "An ant is on a boundary. It sometimes goes **left** and sometimes **right**. You are given an array of **non-zero** integers `nums`. The ant starts reading `nums` from the first element of it to its end. At each step, it moves according to the value of the current element: If `nums[i] < 0`, it moves **left** by `-nums[i]` units. If `nums[i] > 0`, it moves **right** by `nums[i]` units. Return _the number of times the ant **returns** to the boundary._ **Notes:** There is an infinite space on both sides of the boundary. We check whether the ant is on the boundary only after it has moved `|nums[i]|` units. In other words, if the ant crosses the boundary during its movement, it does not count. **Example 1:** ``` **Input:** nums = [2,3,-5] **Output:** 1 **Explanation:** After the first step, the ant is 2 steps to the right of the boundary. After the second step, the ant is 5 steps to the right of the boundary. After the third step, the ant is on the boundary. So the answer is 1. ``` **Example 2:** ``` **Input:** nums = [3,2,-3,-4] **Output:** 0 **Explanation:** After the first step, the ant is 3 steps to the right of the boundary. After the second step, the ant is 5 steps to the right of the boundary. After the third step, the ant is 2 steps to the right of the boundary. After the fourth step, the ant is 2 steps to the left of the boundary. The ant never returned to the boundary, so the answer is 0. ``` **Constraints:** `1 <= nums.length <= 100` `-10 <= nums[i] <= 10` `nums[i] != 0`",
|
| 8 |
+
"public_test_cases": [
|
| 9 |
+
{
|
| 10 |
+
"label": "Example 1",
|
| 11 |
+
"input": "nums = [2,3,-5]",
|
| 12 |
+
"output": "1 "
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"label": "Example 2",
|
| 16 |
+
"input": "nums = [3,2,-3,-4]",
|
| 17 |
+
"output": "0 "
|
| 18 |
+
}
|
| 19 |
+
],
|
| 20 |
+
"private_test_cases": [
|
| 21 |
+
{
|
| 22 |
+
"input": [
|
| 23 |
+
-10,
|
| 24 |
+
9,
|
| 25 |
+
-10,
|
| 26 |
+
10,
|
| 27 |
+
1,
|
| 28 |
+
-8,
|
| 29 |
+
5,
|
| 30 |
+
9,
|
| 31 |
+
-7,
|
| 32 |
+
-9,
|
| 33 |
+
2,
|
| 34 |
+
-8,
|
| 35 |
+
-1,
|
| 36 |
+
-5,
|
| 37 |
+
-7,
|
| 38 |
+
7,
|
| 39 |
+
-5,
|
| 40 |
+
-2,
|
| 41 |
+
-3,
|
| 42 |
+
9,
|
| 43 |
+
-9,
|
| 44 |
+
-9,
|
| 45 |
+
9,
|
| 46 |
+
-3,
|
| 47 |
+
-7,
|
| 48 |
+
-6,
|
| 49 |
+
-9,
|
| 50 |
+
-7,
|
| 51 |
+
0,
|
| 52 |
+
4,
|
| 53 |
+
-1,
|
| 54 |
+
-10,
|
| 55 |
+
0,
|
| 56 |
+
8,
|
| 57 |
+
8,
|
| 58 |
+
-7,
|
| 59 |
+
-1,
|
| 60 |
+
3,
|
| 61 |
+
8,
|
| 62 |
+
-3,
|
| 63 |
+
-1,
|
| 64 |
+
-6
|
| 65 |
+
],
|
| 66 |
+
"output": 1
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"input": [
|
| 70 |
+
-6,
|
| 71 |
+
0,
|
| 72 |
+
7,
|
| 73 |
+
-4,
|
| 74 |
+
-2,
|
| 75 |
+
5,
|
| 76 |
+
3,
|
| 77 |
+
4,
|
| 78 |
+
3,
|
| 79 |
+
-7,
|
| 80 |
+
4,
|
| 81 |
+
-6,
|
| 82 |
+
7,
|
| 83 |
+
8,
|
| 84 |
+
-1,
|
| 85 |
+
5,
|
| 86 |
+
1,
|
| 87 |
+
10,
|
| 88 |
+
-7,
|
| 89 |
+
-6,
|
| 90 |
+
1,
|
| 91 |
+
-5,
|
| 92 |
+
3,
|
| 93 |
+
8,
|
| 94 |
+
-6,
|
| 95 |
+
5,
|
| 96 |
+
-8,
|
| 97 |
+
10,
|
| 98 |
+
-4,
|
| 99 |
+
3,
|
| 100 |
+
-10,
|
| 101 |
+
-3,
|
| 102 |
+
-1,
|
| 103 |
+
10,
|
| 104 |
+
9,
|
| 105 |
+
10,
|
| 106 |
+
-9,
|
| 107 |
+
10,
|
| 108 |
+
-3,
|
| 109 |
+
-3,
|
| 110 |
+
-6,
|
| 111 |
+
0,
|
| 112 |
+
7,
|
| 113 |
+
4,
|
| 114 |
+
2,
|
| 115 |
+
0,
|
| 116 |
+
7,
|
| 117 |
+
2,
|
| 118 |
+
-6
|
| 119 |
+
],
|
| 120 |
+
"output": 1
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"input": [
|
| 124 |
+
-2,
|
| 125 |
+
5,
|
| 126 |
+
1,
|
| 127 |
+
-2,
|
| 128 |
+
7,
|
| 129 |
+
-6,
|
| 130 |
+
6,
|
| 131 |
+
2,
|
| 132 |
+
-2,
|
| 133 |
+
-10,
|
| 134 |
+
10,
|
| 135 |
+
8,
|
| 136 |
+
-3,
|
| 137 |
+
6
|
| 138 |
+
],
|
| 139 |
+
"output": 0
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"input": [
|
| 143 |
+
-2,
|
| 144 |
+
-7,
|
| 145 |
+
-7,
|
| 146 |
+
-10,
|
| 147 |
+
-10
|
| 148 |
+
],
|
| 149 |
+
"output": 0
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"input": [
|
| 153 |
+
-10,
|
| 154 |
+
-9,
|
| 155 |
+
0
|
| 156 |
+
],
|
| 157 |
+
"output": 0
|
| 158 |
+
}
|
| 159 |
+
],
|
| 160 |
+
"haskell_template": "returnToBoundaryCount :: [Int] -> Int\nreturnToBoundaryCount nums ",
|
| 161 |
+
"ocaml_template": "let returnToBoundaryCount (nums: int list) : int = ",
|
| 162 |
+
"scala_template": "def returnToBoundaryCount(nums: List[Int]): Int = { \n \n}",
|
| 163 |
+
"java_template": "class Solution {\n public int returnToBoundaryCount(int[] nums) {\n \n }\n}",
|
| 164 |
+
"python_template": "class Solution(object):\n def returnToBoundaryCount(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n "
|
| 165 |
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
let returnToBoundaryCount (nums: int list) : int = failwith "Not implemented"
|
| 7 |
+
|
| 8 |
+
(* Program end *)
|
| 9 |
+
|
| 10 |
+
(* Test cases *)
|
| 11 |
+
|
| 12 |
+
let test1 _ = assert_equal 1 (returnToBoundaryCount [2;3;-5])
|
| 13 |
+
|
| 14 |
+
let test2 _ = assert_equal 0 (returnToBoundaryCount [3;2;-3;-4])
|
| 15 |
+
|
| 16 |
+
let test3 _ = assert_equal 0 (returnToBoundaryCount [-10; 9; -10; 10; 1; -8; 5; 9; -7; -9; 2; -8; -1; -5; -7; 7; -5; -2; -3; 9; -9; -9; 9; -3; -7; -6; -9; -7; 0; 4; -1; -10; 0; 8; 8; -7; -1; 3; 8; -3; -1; -6])
|
| 17 |
+
|
| 18 |
+
let test4 _ = assert_equal 0 (returnToBoundaryCount [-6; 0; 7; -4; -2; 5; 3; 4; 3; -7; 4; -6; 7; 8; -1; 5; 1; 10; -7; -6; 1; -5; 3; 8; -6; 5; -8; 10; -4; 3; -10; -3; -1; 10; 9; 10; -9; 10; -3; -3; -6; 0; 7; 4; 2; 0; 7; 2; -6])
|
| 19 |
+
|
| 20 |
+
let test5 _ = assert_equal 0 (returnToBoundaryCount [-2; 5; 1; -2; 7; -6; 6; 2; -2; -10; 10; 8; -3; 6])
|
| 21 |
+
|
| 22 |
+
let test6 _ = assert_equal 0 (returnToBoundaryCount [-2; -7; -7; -10; -10])
|
| 23 |
+
|
| 24 |
+
let test7 _ = assert_equal 0 (returnToBoundaryCount [-10; -9; 0])
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
(* Grouping test cases *)
|
| 28 |
+
let suite = "Test Suite for returnToBoundaryCount" >::: [
|
| 29 |
+
|
| 30 |
+
"test1" >:: test1;
|
| 31 |
+
"test2" >:: test2;
|
| 32 |
+
"test3" >:: test3;
|
| 33 |
+
"test4" >:: test4;
|
| 34 |
+
"test5" >:: test5;
|
| 35 |
+
"test6" >:: test6;
|
| 36 |
+
"test7" >:: test7;
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
(* Running the tests *)
|
| 41 |
+
let () = run_test_tt_main suite
|
| 42 |
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.returnToBoundaryCount(List(2,3,-5)), 1)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.returnToBoundaryCount(List(3,2,-3,-4)), 0)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.returnToBoundaryCount(-10,9,-10,10,1,-8,5,9,-7,-9,2,-8,-1,-5,-7,7,-5,-2,-3,9,-9,-9,9,-3,-7,-6,-9,-7,0,4,-1,-10,0,8,8,-7,-1,3,8,-3,-1,-6), 1)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
test("test4") {
|
| 17 |
+
assertEquals(Main.returnToBoundaryCount(-6,0,7,-4,-2,5,3,4,3,-7,4,-6,7,8,-1,5,1,10,-7,-6,1,-5,3,8,-6,5,-8,10,-4,3,-10,-3,-1,10,9,10,-9,10,-3,-3,-6,0,7,4,2,0,7,2,-6), 1)
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
test("test5") {
|
| 21 |
+
assertEquals(Main.returnToBoundaryCount(-2,5,1,-2,7,-6,6,2,-2,-10,10,8,-3,6), 0)
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
test("test6") {
|
| 25 |
+
assertEquals(Main.returnToBoundaryCount(-2,-7,-7,-10,-10), 0)
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
test("test7") {
|
| 29 |
+
assertEquals(Main.returnToBoundaryCount(-10,-9,0), 0)
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
}
|
|
Binary file (6.15 kB). View file
|
|
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main where
|
| 3 |
+
import Test.HUnit
|
| 4 |
+
|
| 5 |
+
--Program start
|
| 6 |
+
|
| 7 |
+
--Program end
|
| 8 |
+
|
| 9 |
+
-- Test cases
|
| 10 |
+
|
| 11 |
+
test1 :: Test
|
| 12 |
+
test1 = TestCase (assertEqual "for (appendCharacters \"coaching \" \"coding \")," 4 (appendCharacters "coaching" "coding"))
|
| 13 |
+
|
| 14 |
+
test2 :: Test
|
| 15 |
+
test2 = TestCase (assertEqual "for (appendCharacters \"abcde \" \"a \")," 0 (appendCharacters "abcde" "a"))
|
| 16 |
+
|
| 17 |
+
test3 :: Test
|
| 18 |
+
test3 = TestCase (assertEqual "for (appendCharacters \"z \" \"abcde \")," 5 (appendCharacters "z" "abcde"))
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
-- Grouping test cases
|
| 22 |
+
tests :: Test
|
| 23 |
+
tests = TestList [TestLabel "Test1" test1, TestLabel "Test2" test2]
|
| 24 |
+
|
| 25 |
+
-- Running the tests
|
| 26 |
+
main :: IO Counts
|
| 27 |
+
main = runTestTT tests
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import static org.junit.jupiter.api.Assertions.*;
|
| 3 |
+
import org.junit.jupiter.api.Test;
|
| 4 |
+
import java.util.List;
|
| 5 |
+
import java.util.Arrays;
|
| 6 |
+
import java.util.ArrayList;
|
| 7 |
+
public class Main {
|
| 8 |
+
//Program start
|
| 9 |
+
|
| 10 |
+
//Program end
|
| 11 |
+
|
| 12 |
+
@Test
|
| 13 |
+
public void test1() {
|
| 14 |
+
assertEquals(4, appendCharacters("coaching", "coding"));
|
| 15 |
+
}
|
| 16 |
+
@Test
|
| 17 |
+
public void test2() {
|
| 18 |
+
assertEquals(0, appendCharacters("abcde", "a"));
|
| 19 |
+
}
|
| 20 |
+
@Test
|
| 21 |
+
public void test3() {
|
| 22 |
+
assertEquals(5, appendCharacters("z", "abcde"));
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
}
|
|
The diff for this file is too large to render.
See raw diff
|
|
|
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
module Main = struct
|
| 3 |
+
open OUnit2
|
| 4 |
+
|
| 5 |
+
(* Program start *)
|
| 6 |
+
|
| 7 |
+
(* Program end *)
|
| 8 |
+
|
| 9 |
+
(* Test cases *)
|
| 10 |
+
|
| 11 |
+
let test1 _ = assert_equal 4 (appendCharacters "coaching" "coding")
|
| 12 |
+
|
| 13 |
+
let test2 _ = assert_equal 0 (appendCharacters "abcde" "a")
|
| 14 |
+
|
| 15 |
+
let test3 _ = assert_equal 5 (appendCharacters "z" "abcde")
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
(* Grouping test cases *)
|
| 19 |
+
let suite = "Test Suite for appendCharacters" >::: [
|
| 20 |
+
|
| 21 |
+
"test1" >:: test1;
|
| 22 |
+
"test2" >:: test2;
|
| 23 |
+
"test3" >:: test3;
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
(* Running the tests *)
|
| 28 |
+
let () = run_test_tt_main suite
|
| 29 |
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
class MySuite extends munit.FunSuite {
|
| 3 |
+
|
| 4 |
+
test("test1") {
|
| 5 |
+
assertEquals(Main.appendCharacters("coaching","coding"), 4)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
test("test2") {
|
| 9 |
+
assertEquals(Main.appendCharacters("abcde","a"), 0)
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
test("test3") {
|
| 13 |
+
assertEquals(Main.appendCharacters("z","abcde"), 5)
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
}
|