Questions tagged [ragged-list]

A ragged list, also called a jagged list, is a list where each element can either be some terminal type (e.g. an integer) or another ragged list.

44 questions
Filter by
Sorted by
Tagged with
2k views

Search the deepest depths of an array

Given a ragged array, find the length of the largest subarray that contains the depth of that subarray. The base array layer has a depth of 0. Here is an example: ...
• 4,173
494 views

• 6,015
1k views

• 98.7k
963 views

Array depth of a ragged list

This is not a duplicate of this challenge. Here by an array, I mean a nested list that is "not ragged", i.e., it is either a list of elements, or a list of arrays of the same shape. For ...
• 48k
761 views

Minimum depth of a ragged list

As input you will be given a ragged list of positive integers containing at least one integer at some level. For example: [[],[[1,2,[3]]],[]] You should output ...
• 98.7k
870 views

Make every fixed list

We are to define the idea of a fixed list as follows: A fixed list is a list of fixed lists. This definition is recursive so it's useful to look at some examples. The empty list ...
• 98.7k
985 views

Compare shapeless lists

Let's have a ragged list containing no values, only more lists. For example: [[[],[[]],[],[]],[],[[],[],[]],[]] And the list will be finite, meaning that ...
• 98.7k
1k views

Find the maximum length in a ragged list

Given a ragged list of positive integers find the size of the largest list contained somewhere in it. For example: [1,[1,[8,2,[1,2],5,4,9]],2,[],3] Here the answer ...
• 98.7k
1k views

Scan a ragged list

hgl has a "scan" function called sc. What it does in general is a little bit abstract, so we will just talk about one specific way you can use it. If we ...
• 98.7k
2k views

Collect the elements of an array

Add++, the Language of the Month, has the "collect" builtin as BC. Your task is to implement this builtin. Consider a non-empty array, where each element ...
• 49.9k
2k views

Reconstruct a recursively prime-encoded integer

Recursively prime-encoded integers Consider $11681169775023850 = 2 \times 5 \times 5 \times 42239 \times 5530987843$. This isn't a nice prime factorisation, as $42239$ and $5530987843$ make it ...
• 49.9k
3k views

Create a function (or closest equivalent, or full program) that takes an list of some datatype (your choice) that may be nested and a string (in either order), and generalizes the lisp c[ad]+r ...
• 1,478
3k views

Pad a jagged array to be square

Given a 2-dimensional jagged array and a fill value, pad the array in both dimensions with the fill value to ensure that it is square and not jagged (i.e., all rows are the same length, and that ...
• 23.7k
2k views

Deep Search a List

For this challenge, a list is considered valid if and only if it consists entirely of integers and valid lists (recursive definitions \o/). For this challenge, given a valid list and an integer, ...
• 42.4k
1k views

Decode the Void

A void list is a list that at no level contains any non-list objects. Or if you prefer a recursive definition The empty list is void A list containing only other void lists is void All void lists ...
• 98.7k
6k views

Background Inspired by Octave's (and, by extension, MATL's) very convenient interpretation of truthy/falsy matrices, Jelly got the Ȧ (Octave-style all) atom. Ȧ takes an array as input and returns 1 ...
• 210k
2k views

Find the "Recursive Size" of a List

Inspired by Find the “unwrapped size” of a list. Define the Recursive Size, RS, of a list containing no lists as its length (number of items contained) and the ...
• 106k
2k views

B​u​i​l​d a n​e​s​t

The challenge is simple: write a program or function that, when given a finite non-negative integer, outputs a nested array. The rules Your code must produce a unique valid nested array for every ...
8k views

Flatten the Array! [duplicate]

In this challenge, your task is to create a program which takes in a nested array and returns a single-dimensional flattened array. For Example [10,20,[30,[40]],50] ...
• 5,054
2k views

Reverse an N-Dimensional array

Details Write a function or program that, given an array (or list), containing only integers, returns or output an array with all sub-elements reversed. That is, reverse all elements of the deepest ...
• 709
11k views

Determine the depth of an array

A simple challenge for your Monday evening (well, or Tuesday morning in the other half of the world...) You're given as input a nested, potentially ragged array of positive integers: ...
• 197k
7k views

Unflatten an Array

This challenge was inspired by a question on Mathematica.SE. Say you've got a nested list/array of some arbitrary structure (the lists at each level don't necessarily have the same length). For ...
• 197k