Skip to main content
added 12 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits in the runs to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876

Input:  [9090, 123]
Output: 123

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876

Input:  [9090, 123]
Output: 123

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits in the runs to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876

Input:  [9090, 123]
Output: 123

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!
added 41 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876 

Input:  [9090, 123]
Output: 123

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876 

Input:  [9090, 123]
Output: 123

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!
Tweeted twitter.com/StackCodeGolf/status/892753589176860672
added 52 characters in body; added 52 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5 

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!

Simple challenge: given a series of positive integer numbers, find the number that contains among its digits the longest run of consecutive digits. The trick? It's allowed for the digits to wrap around the possible values (0123456789) and to run backwards. So both 2345, 89012 and 5432109 are valid runs of consecutive digits (but not 3456765 nor 321090123 as the run must be always in the same direction, although 3456765 can be considered as two runs: 34567 and 765). In the case of ties, return the first one.

Test cases:

Input:  [3274569283, 387652323, 23987654323648, 2345687913624]
Output: 23987654323648 
        (The run is 98765432; run length: 8)

Input:  [123012363672023, 098761766325432, 15890123456765]
Output: 15890123456765
        (The run is 8901234567; run length: 10)

Input:  [43, 19, 456]
Output: 456

Input:  [5, 9, 0]
Output: 5 

Input:  [71232107, 7012347]
Output: 7012347

Input:  [1234, 32109876]
Output: 32109876

Notes:

  • There will be at least one number in the input.
  • Input numbers can contain leading zeroes.
  • Input and output can be in any reasonable format. So input numbers can be taken as strings, lists of digits/characters...
  • Output can contain trailing and/or leading whitespaces and newlines as long as the number is printed.
  • This is , so may the shortest program/function for each language win!
edited tags
Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100
Loading
added 71 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100
Loading
added 14 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100
Loading
added 31 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100
Loading
added 22 characters in body
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100
Loading
Source Link
Charlie
  • 12.9k
  • 1
  • 42
  • 100
Loading