Skip to main content
Became Hot Network Question
Tweeted twitter.com/StackCodeGolf/status/1479196084928921611
added 11 characters in body
Source Link
Wheat Wizard
  • 102.9k
  • 23
  • 299
  • 698

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 is 6 because one of the lists has 6 elements and all other lists have fewer.

[1,[1,[8,2,[1,2],5,4,9]],2,[],3] ^ ^ ^ ^ ^ ^ 

The length doesn't care in any way about the value of the elements, so a list can be longer than the list that contains it.

Task

Given a ragged list of positive integers output the size of the largest list contained somewhere in it. You may take input in any reasonable format.

This is so answers will be scored in bytes with the goal being to minimize the size of your source-code.

Testcases

[] -> 0 [[]] -> 1 [1,2,3] -> 3 [[1,2,3]] -> 3 [1,2,[],1] -> 4 [1,[1,[8,2,[1,2],5,4,9]],2,[],3] -> 6 

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 is 6 because one of the lists has 6 elements and all other lists have fewer.

[1,[1,[8,2,[1,2],5,4,9]],2,[],3] ^ ^ ^ ^ ^ ^ 

The length doesn't care in any way about the value of the elements, so a list can be longer than the list that contains it.

Task

Given a ragged list of positive integers output the size of the largest list contained somewhere in it. You may take input in any reasonable format.

This is so answers will be scored in bytes with the goal being to minimize the size of your source-code.

Testcases

[] -> 0 [1,2,3] -> 3 [[1,2,3]] -> 3 [1,2,[],1] -> 4 [1,[1,[8,2,[1,2],5,4,9]],2,[],3] -> 6 

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 is 6 because one of the lists has 6 elements and all other lists have fewer.

[1,[1,[8,2,[1,2],5,4,9]],2,[],3] ^ ^ ^ ^ ^ ^ 

The length doesn't care in any way about the value of the elements, so a list can be longer than the list that contains it.

Task

Given a ragged list of positive integers output the size of the largest list contained somewhere in it. You may take input in any reasonable format.

This is so answers will be scored in bytes with the goal being to minimize the size of your source-code.

Testcases

[] -> 0 [[]] -> 1 [1,2,3] -> 3 [[1,2,3]] -> 3 [1,2,[],1] -> 4 [1,[1,[8,2,[1,2],5,4,9]],2,[],3] -> 6 
Source Link
Wheat Wizard
  • 102.9k
  • 23
  • 299
  • 698

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 is 6 because one of the lists has 6 elements and all other lists have fewer.

[1,[1,[8,2,[1,2],5,4,9]],2,[],3] ^ ^ ^ ^ ^ ^ 

The length doesn't care in any way about the value of the elements, so a list can be longer than the list that contains it.

Task

Given a ragged list of positive integers output the size of the largest list contained somewhere in it. You may take input in any reasonable format.

This is so answers will be scored in bytes with the goal being to minimize the size of your source-code.

Testcases

[] -> 0 [1,2,3] -> 3 [[1,2,3]] -> 3 [1,2,[],1] -> 4 [1,[1,[8,2,[1,2],5,4,9]],2,[],3] -> 6