From 55903203b0d9f5716f0a68632fba8717273e647c Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Mon, 17 Mar 2025 01:29:52 +0530 Subject: [PATCH 1/7] Updating test.toml --- .../practice/flatten-array/.meta/tests.toml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/exercises/practice/flatten-array/.meta/tests.toml b/exercises/practice/flatten-array/.meta/tests.toml index 6300219d7..44acf175d 100644 --- a/exercises/practice/flatten-array/.meta/tests.toml +++ b/exercises/practice/flatten-array/.meta/tests.toml @@ -32,12 +32,32 @@ description = "null values are omitted from the final result" [c6cf26de-8ccd-4410-84bd-b9efd88fd2bc] description = "consecutive null values at the front of the list are omitted from the final result" +include = false + +[bc72da10-5f55-4ada-baf3-50e4da02ec8e] +description = "consecutive null values at the front of the array are omitted from the final result" +reimplements = "c6cf26de-8ccd-4410-84bd-b9efd88fd2bc" [382c5242-587e-4577-b8ce-a5fb51e385a1] description = "consecutive null values in the middle of the list are omitted from the final result" +include = false + +[6991836d-0d9b-4703-80a0-3f1f23eb5981] +description = "consecutive null values in the middle of the array are omitted from the final result" +reimplements = "382c5242-587e-4577-b8ce-a5fb51e385a1" [ef1d4790-1b1e-4939-a179-51ace0829dbd] description = "6 level nest list with null values" +include = false + +[dc90a09c-5376-449c-a7b3-c2d20d540069] +description = "6 level nested array with null values" +reimplements = "ef1d4790-1b1e-4939-a179-51ace0829dbd" [85721643-705a-4150-93ab-7ae398e2942d] description = "all values in nested list are null" +include = false + +[51f5d9af-8f7f-4fb5-a156-69e8282cb275] +description = "all values in nested array are null" +reimplements = "85721643-705a-4150-93ab-7ae398e2942d" From 051267c34f2ec43f5a5f1749fcb7f4eb92977abe Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Mon, 17 Mar 2025 19:36:42 +0530 Subject: [PATCH 2/7] Syncing docs with problem-specification --- .../practice/flatten-array/.docs/instructions.md | 15 ++++++++++----- .../practice/flatten-array/.docs/introduction.md | 7 +++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 exercises/practice/flatten-array/.docs/introduction.md diff --git a/exercises/practice/flatten-array/.docs/instructions.md b/exercises/practice/flatten-array/.docs/instructions.md index 89dacfa32..b5b82713d 100644 --- a/exercises/practice/flatten-array/.docs/instructions.md +++ b/exercises/practice/flatten-array/.docs/instructions.md @@ -1,11 +1,16 @@ # Instructions -Take a nested list and return a single flattened list with all values except nil/null. +Take a nested array of any depth and return a fully flattened array. -The challenge is to take an arbitrarily-deep nested list-like structure and produce a flattened structure without any nil/null values. +Note that some language tracks may include null-like values in the input array, and the way these values are represented varies by track. +Such values should be excluded from the flattened array. -For example: +Additionally, the input may be of a different data type and contain different types, depending on the track. -input: [1,[2,3,null,4],[null],5] +Check the test suite for details. -output: [1,2,3,4,5] +## Example + +input: `[1, [2, 6, null], [[null, [4]], 5]]` + +output: `[1, 2, 6, 4, 5]` diff --git a/exercises/practice/flatten-array/.docs/introduction.md b/exercises/practice/flatten-array/.docs/introduction.md new file mode 100644 index 000000000..a31485746 --- /dev/null +++ b/exercises/practice/flatten-array/.docs/introduction.md @@ -0,0 +1,7 @@ +# Introduction + +A shipment of emergency supplies has arrived, but there's a problem. +To protect from damage, the items — flashlights, first-aid kits, blankets — are packed inside boxes, and some of those boxes are nested several layers deep inside other boxes! + +To be prepared for an emergency, everything must be easily accessible in one box. +Can you unpack all the supplies and place them into a single box, so they're ready when needed most? From 6a71cf58ec3e041169dac52147243263d2c01f5d Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Mon, 17 Mar 2025 19:45:17 +0530 Subject: [PATCH 3/7] Adding instructions.append.md --- exercises/practice/flatten-array/.docs/instructions.append.md | 3 +++ exercises/practice/flatten-array/.meta/config.json | 1 + 2 files changed, 4 insertions(+) create mode 100644 exercises/practice/flatten-array/.docs/instructions.append.md diff --git a/exercises/practice/flatten-array/.docs/instructions.append.md b/exercises/practice/flatten-array/.docs/instructions.append.md new file mode 100644 index 000000000..b35852d3f --- /dev/null +++ b/exercises/practice/flatten-array/.docs/instructions.append.md @@ -0,0 +1,3 @@ +~~~~exercism/note +For the Java track, the input will be provided as a `List` instead of an array, and the output should also be a `List`. +~~~~ \ No newline at end of file diff --git a/exercises/practice/flatten-array/.meta/config.json b/exercises/practice/flatten-array/.meta/config.json index 8b521fdd6..4d184fd51 100644 --- a/exercises/practice/flatten-array/.meta/config.json +++ b/exercises/practice/flatten-array/.meta/config.json @@ -9,6 +9,7 @@ "jagdish-15", "jmrunkle", "jtigger", + "kahgoh", "kytrinyx", "lemoncurry", "michaelspets", From 1c62194cbf48cb1bad5aaa30dbc56bf1fefdc8c5 Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Mon, 17 Mar 2025 19:51:49 +0530 Subject: [PATCH 4/7] Adding single line at the end of instructions.append.md --- exercises/practice/flatten-array/.docs/instructions.append.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/practice/flatten-array/.docs/instructions.append.md b/exercises/practice/flatten-array/.docs/instructions.append.md index b35852d3f..cff98d221 100644 --- a/exercises/practice/flatten-array/.docs/instructions.append.md +++ b/exercises/practice/flatten-array/.docs/instructions.append.md @@ -1,3 +1,3 @@ ~~~~exercism/note For the Java track, the input will be provided as a `List` instead of an array, and the output should also be a `List`. -~~~~ \ No newline at end of file +~~~~ From b82520940f3d4add695188f898e7b1c622f7c046 Mon Sep 17 00:00:00 2001 From: jagdish-15 Date: Tue, 18 Mar 2025 18:42:39 +0530 Subject: [PATCH 5/7] Update exercises/practice/flatten-array/.meta/config.json Co-authored-by: Kah Goh --- exercises/practice/flatten-array/.meta/config.json | 1 - 1 file changed, 1 deletion(-) diff --git a/exercises/practice/flatten-array/.meta/config.json b/exercises/practice/flatten-array/.meta/config.json index 4d184fd51..8b521fdd6 100644 --- a/exercises/practice/flatten-array/.meta/config.json +++ b/exercises/practice/flatten-array/.meta/config.json @@ -9,7 +9,6 @@ "jagdish-15", "jmrunkle", "jtigger", - "kahgoh", "kytrinyx", "lemoncurry", "michaelspets", From 7fbffa64caf78945c09f3c315e5bd19e73bd4d7f Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Tue, 18 Mar 2025 18:46:27 +0530 Subject: [PATCH 6/7] Adding heading to append --- exercises/practice/flatten-array/.docs/instructions.append.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exercises/practice/flatten-array/.docs/instructions.append.md b/exercises/practice/flatten-array/.docs/instructions.append.md index cff98d221..fdebb3d81 100644 --- a/exercises/practice/flatten-array/.docs/instructions.append.md +++ b/exercises/practice/flatten-array/.docs/instructions.append.md @@ -1,3 +1,2 @@ -~~~~exercism/note +# Instructions append For the Java track, the input will be provided as a `List` instead of an array, and the output should also be a `List`. -~~~~ From bbf23d44d08406f50a52f0b64193640f89484b2f Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Tue, 18 Mar 2025 18:47:34 +0530 Subject: [PATCH 7/7] Adding empty line after heading --- exercises/practice/flatten-array/.docs/instructions.append.md | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/practice/flatten-array/.docs/instructions.append.md b/exercises/practice/flatten-array/.docs/instructions.append.md index fdebb3d81..c5bf8cb0c 100644 --- a/exercises/practice/flatten-array/.docs/instructions.append.md +++ b/exercises/practice/flatten-array/.docs/instructions.append.md @@ -1,2 +1,3 @@ # Instructions append + For the Java track, the input will be provided as a `List` instead of an array, and the output should also be a `List`.