Skip to main content
edited body
Source Link
Wheat Wizard
  • 102.9k
  • 23
  • 299
  • 697

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 26432-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [4,0,0,0,0,4] -> 1 [] -> 0 

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 264-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [4,0,0,0,0,4] -> 1 [] -> 0 

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 232-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [4,0,0,0,0,4] -> 1 [] -> 0 
Tweeted twitter.com/StackCodeGolf/status/901652629209669632
added 24 characters in body
Source Link
Wheat Wizard
  • 102.9k
  • 23
  • 299
  • 697

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 264-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [4,0,0,0,0,4] -> 1 [] -> 0 

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 264-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [] -> 0 

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 264-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [4,0,0,0,0,4] -> 1 [] -> 0 
added 13 characters in body
Source Link
Wheat Wizard
  • 102.9k
  • 23
  • 299
  • 697

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 264-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [] -> 0 

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 264-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 

Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array

[5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ^ [5,4,3] ^ [5,4,3] ^ 

The same element can be collapsed multiple times, for example [1,1,2] becomes [4] when crushed.

We will call an array uncrushable when the process of crushing that array does not change it. For example [1,2,3] is still [1,2,3] after being crushed.

Your task is to take an array and determine the number of crushes required to make it uncrushable. You need only support integers on the range of 0 to 264-1

This is so answers will be scored in bytes with less bytes being better.

Test Cases

[1] -> 0 [1,1] -> 1 [2,1,1] -> 2 [4,2,1,1] -> 3 [2,2,2,1,1] -> 3 [0,0,0,0] -> 1 [4,0,0,0,4] -> 1 [] -> 0 
Source Link
Wheat Wizard
  • 102.9k
  • 23
  • 299
  • 697
Loading