5 deleted 197 characters in body
source | link

As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below.

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data-100]], {0..}] /.x:{1..}:>Length@x

works too.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

Edit

The following tests for elements greater than 100

Length/@DeleteCases[Split[1-UnitStep[100-data]],{0..}]

DeleteCases[Split[1-UnitStep[100@DeleteCases[Split[UnitStep[100-data]],{0..}]/.x:{1..}:>Length@x]

Thanks to Mr. Wizard to pointing out mistakes and performance issues in this post!

As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data-100]], {0..}] /.x:{1..}:>Length@x

works too.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

Edit

The following tests for elements greater than 100

Length/@DeleteCases[Split[1-UnitStep[100-data]],{0..}]

DeleteCases[Split[1-UnitStep[100-data]],{0..}]/.x:{1..}:>Length@x

As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below.

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Edit

The following tests for elements greater than 100

Length/@DeleteCases[Split[UnitStep[100-data]],{1..}]

Thanks to Mr. Wizard to pointing out mistakes and performance issues in this post!

4 added 169 characters in body
source | link

As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List x:> Length@x{1..}:>Length@x

works too and seems to be a bit faster.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

Edit

I just read Mr. Wizards comment above and indeedThe following tests for elements greater than 100

Thread[LengthLength/@DeleteCases[Split[1-UnitStep[100-data]], DeleteCases[Split[UnitStep[data {0..}]

DeleteCases[Split[1- 100]]UnitStep[100-data]], {0 ..}]]]/.x:{1..}:>Length@x

is a bit faster than the Map version.

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x

works too and seems to be a bit faster.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

Edit

I just read Mr. Wizards comment above and indeed

Thread[Length, DeleteCases[Split[UnitStep[data - 100]], {0 ..}]]

is a bit faster than the Map version.

As Mr. Wizard pointed out in the comments, my original code tests for elements greater or equal 100, a corrected version is in the edit below

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data-100]], {0..}] /.x:{1..}:>Length@x

works too.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

Edit

The following tests for elements greater than 100

Length/@DeleteCases[Split[1-UnitStep[100-data]],{0..}]

DeleteCases[Split[1-UnitStep[100-data]],{0..}]/.x:{1..}:>Length@x
3 added 180 characters in body
source | link

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x

works too and seems to be a bit faster.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

Edit

I just read Mr. Wizards comment above and indeed

Thread[Length, DeleteCases[Split[UnitStep[data - 100]], {0 ..}]]

is a bit faster than the Map version.

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x

works too and seems to be a bit faster.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

I interpreted the question to include singletons and came up with the following, which I think performs decently

Length/@DeleteCases[Split[UnitStep[data-100]],{0..}]

Alternatively

DeleteCases[Split[UnitStep[data - 100]], {0 ..}] /. x_List :> Length@x

works too and seems to be a bit faster.

(Also, I really hope this is not a duplicate of a previous answer. They are all a bit similar...)

Edit

I just read Mr. Wizards comment above and indeed

Thread[Length, DeleteCases[Split[UnitStep[data - 100]], {0 ..}]]

is a bit faster than the Map version.

2 added 119 characters in body
source | link
1
source | link