Skip to main content
Commonmark migration
Source Link

In this challenge, you are passed two words: Your job is to determine if they are adjacent.

Two letters are adjacent if:

  1. They are the same letter, or
  2. They are lexicographically adjacent.

For example, J is adjacent to I,J, and K only. Z is not adjacent to A

Two words are adjacent if:

  1. They are the same length, and
  2. Each letter is adjacent to a unique letter in the other word.

For example, CAT is adjacent to SAD, as C>D, A>A, T>S.
FREE is not adjacent to GRRD (each E needs a letter to pair with)
.

##Input/Output

Input/Output

You are passed two strings, and you need to return a truthy value if they are adjacent, otherwise a falsy value. You should return within a minute for all test cases below.

You can assume that the strings will only contain uppercase, alphabetic letters.

The two strings can be passed as a list, or concatenated, with or without quotes.

##Test Cases

Test Cases

Truthy:

A A A B C B DD CE DE FC ABCD BCDE AACC DBBB DJENSKE FDJCLMT DEFGHIJKL HJLEHMCHE IKLIJJLIJKKL LJLJLJLJLJHI ACEGIKMOQSUWY BLNPRDFTVHXJZ QQSQQRRQSTTUQQRRRS PQTTPPTTQTPQPPQRTP ELKNSDUUUELSKJFESD DKJELKNSUELSDUFEUS 

Falsy:

A C A Z B J JK J CC BA CE D DJENSKE GDJCLMT DEFGHIJKL HJLHMCHE IJKLIJKLKIJL LIJLLHJLJLLL AWSUKMEGICOQY RSHXBLJLNQDFZ QQSQQRRQSTTUQQQRRS PQTTPPTTQTPQPPQRTT ELKNSDUVWELSKJFESD DKJELKNSUELSDUFEUS 

This is , so the shortest valid answer wins!

In this challenge, you are passed two words: Your job is to determine if they are adjacent.

Two letters are adjacent if:

  1. They are the same letter, or
  2. They are lexicographically adjacent.

For example, J is adjacent to I,J, and K only. Z is not adjacent to A

Two words are adjacent if:

  1. They are the same length, and
  2. Each letter is adjacent to a unique letter in the other word.

For example, CAT is adjacent to SAD, as C>D, A>A, T>S.
FREE is not adjacent to GRRD (each E needs a letter to pair with)
.

##Input/Output

You are passed two strings, and you need to return a truthy value if they are adjacent, otherwise a falsy value. You should return within a minute for all test cases below.

You can assume that the strings will only contain uppercase, alphabetic letters.

The two strings can be passed as a list, or concatenated, with or without quotes.

##Test Cases

Truthy:

A A A B C B DD CE DE FC ABCD BCDE AACC DBBB DJENSKE FDJCLMT DEFGHIJKL HJLEHMCHE IKLIJJLIJKKL LJLJLJLJLJHI ACEGIKMOQSUWY BLNPRDFTVHXJZ QQSQQRRQSTTUQQRRRS PQTTPPTTQTPQPPQRTP ELKNSDUUUELSKJFESD DKJELKNSUELSDUFEUS 

Falsy:

A C A Z B J JK J CC BA CE D DJENSKE GDJCLMT DEFGHIJKL HJLHMCHE IJKLIJKLKIJL LIJLLHJLJLLL AWSUKMEGICOQY RSHXBLJLNQDFZ QQSQQRRQSTTUQQQRRS PQTTPPTTQTPQPPQRTT ELKNSDUVWELSKJFESD DKJELKNSUELSDUFEUS 

This is , so the shortest valid answer wins!

In this challenge, you are passed two words: Your job is to determine if they are adjacent.

Two letters are adjacent if:

  1. They are the same letter, or
  2. They are lexicographically adjacent.

For example, J is adjacent to I,J, and K only. Z is not adjacent to A

Two words are adjacent if:

  1. They are the same length, and
  2. Each letter is adjacent to a unique letter in the other word.

For example, CAT is adjacent to SAD, as C>D, A>A, T>S.
FREE is not adjacent to GRRD (each E needs a letter to pair with)
.

Input/Output

You are passed two strings, and you need to return a truthy value if they are adjacent, otherwise a falsy value. You should return within a minute for all test cases below.

You can assume that the strings will only contain uppercase, alphabetic letters.

The two strings can be passed as a list, or concatenated, with or without quotes.

Test Cases

Truthy:

A A A B C B DD CE DE FC ABCD BCDE AACC DBBB DJENSKE FDJCLMT DEFGHIJKL HJLEHMCHE IKLIJJLIJKKL LJLJLJLJLJHI ACEGIKMOQSUWY BLNPRDFTVHXJZ QQSQQRRQSTTUQQRRRS PQTTPPTTQTPQPPQRTP ELKNSDUUUELSKJFESD DKJELKNSUELSDUFEUS 

Falsy:

A C A Z B J JK J CC BA CE D DJENSKE GDJCLMT DEFGHIJKL HJLHMCHE IJKLIJKLKIJL LIJLLHJLJLLL AWSUKMEGICOQY RSHXBLJLNQDFZ QQSQQRRQSTTUQQQRRS PQTTPPTTQTPQPPQRTT ELKNSDUVWELSKJFESD DKJELKNSUELSDUFEUS 

This is , so the shortest valid answer wins!

edited tags
Link
user45941
user45941
Tweeted twitter.com/StackCodeGolf/status/693598523426750466
added 98 characters in body
Source Link
Nathan Merrill
  • 14.5k
  • 3
  • 53
  • 132

In this challenge, you are passed two words: Your job is to determine if they are adjacent.

Two letters are adjacent if:

  1. They are the same letter, or
  2. They are lexicographically adjacent.

For example, J is adjacent to I,J, and K only. Z is not adjacent to A

Two words are adjacent if:

  1. They are the same length, and
  2. Each letter is adjacent to a unique letter in the other word.

For example, CAT is adjacent to SAD, as C>D, A>A, T>S.
FREE is not adjacent to GRRD (each E needs a letter to pair with)
.

##Input/Output

You are passed two strings, and you need to return a truthy value if they are adjacent, otherwise a falsy value. You should return within a minute for all test cases below.

You can assume that the strings will only contain uppercase, alphabetic letters.

The two strings can be passed as a list, or concatenated, with or without quotes.

##Test Cases

Truthy:

A A A B C B DD CE DE FC ABCD BCDE AACC DBBB DJENSKE FDJCLMT DEFGHIJKL HJLEHMCHE IKLIJJLIJKKL LJLJLJLJLJHI ACEGIKMOQSUWY BLNPRDFTVHXJZ QQSQQRRQSTTUQQRRRS PQTTPPTTQTPQPPQRTP ELKNSDUUUELSKJFESD DKJELKNSUELSDUFEUS 

Falsy:

A C A Z B J JK J CC BA CE D DJENSKE GDJCLMT DEFGHIJKL HJLHMCHE IJKLIJKLKIJL LIJLLHJLJLLL AWSUKMEGICOQY RSHXBLJLNQDFZ QQSQQRRQSTTUQQQRRS PQTTPPTTQTPQPPQRTT ELKNSDUVWELSKJFESD DKJELKNSUELSDUFEUS 

This is , so the shortest valid answer wins!

In this challenge, you are passed two words: Your job is to determine if they are adjacent.

Two letters are adjacent if:

  1. They are the same letter, or
  2. They are lexicographically adjacent.

For example, J is adjacent to I,J, and K only. Z is not adjacent to A

Two words are adjacent if:

  1. They are the same length, and
  2. Each letter is adjacent to a unique letter in the other word.

For example, CAT is adjacent to SAD, as C>D, A>A, T>S.
FREE is not adjacent to GRRD (each E needs a letter to pair with)
.

##Input/Output

You are passed two strings, and you need to return a truthy value if they are adjacent, otherwise a falsy value. You should return within a minute for all test cases below.

You can assume that the strings will only contain alphabetic letters.

##Test Cases

Truthy:

A A A B C B DD CE DE FC ABCD BCDE AACC DBBB DJENSKE FDJCLMT DEFGHIJKL HJLEHMCHE IKLIJJLIJKKL LJLJLJLJLJHI ACEGIKMOQSUWY BLNPRDFTVHXJZ QQSQQRRQSTTUQQRRRS PQTTPPTTQTPQPPQRTP ELKNSDUUUELSKJFESD DKJELKNSUELSDUFEUS 

Falsy:

A C A Z B J JK J CC BA CE D DJENSKE GDJCLMT DEFGHIJKL HJLHMCHE IJKLIJKLKIJL LIJLLHJLJLLL AWSUKMEGICOQY RSHXBLJLNQDFZ QQSQQRRQSTTUQQQRRS PQTTPPTTQTPQPPQRTT ELKNSDUVWELSKJFESD DKJELKNSUELSDUFEUS 

This is , so the shortest valid answer wins!

In this challenge, you are passed two words: Your job is to determine if they are adjacent.

Two letters are adjacent if:

  1. They are the same letter, or
  2. They are lexicographically adjacent.

For example, J is adjacent to I,J, and K only. Z is not adjacent to A

Two words are adjacent if:

  1. They are the same length, and
  2. Each letter is adjacent to a unique letter in the other word.

For example, CAT is adjacent to SAD, as C>D, A>A, T>S.
FREE is not adjacent to GRRD (each E needs a letter to pair with)
.

##Input/Output

You are passed two strings, and you need to return a truthy value if they are adjacent, otherwise a falsy value. You should return within a minute for all test cases below.

You can assume that the strings will only contain uppercase, alphabetic letters.

The two strings can be passed as a list, or concatenated, with or without quotes.

##Test Cases

Truthy:

A A A B C B DD CE DE FC ABCD BCDE AACC DBBB DJENSKE FDJCLMT DEFGHIJKL HJLEHMCHE IKLIJJLIJKKL LJLJLJLJLJHI ACEGIKMOQSUWY BLNPRDFTVHXJZ QQSQQRRQSTTUQQRRRS PQTTPPTTQTPQPPQRTP ELKNSDUUUELSKJFESD DKJELKNSUELSDUFEUS 

Falsy:

A C A Z B J JK J CC BA CE D DJENSKE GDJCLMT DEFGHIJKL HJLHMCHE IJKLIJKLKIJL LIJLLHJLJLLL AWSUKMEGICOQY RSHXBLJLNQDFZ QQSQQRRQSTTUQQQRRS PQTTPPTTQTPQPPQRTT ELKNSDUVWELSKJFESD DKJELKNSUELSDUFEUS 

This is , so the shortest valid answer wins!

Better wording
Source Link
user45941
user45941
Loading
edited body
Source Link
Nathan Merrill
  • 14.5k
  • 3
  • 53
  • 132
Loading
edited body
Source Link
Nathan Merrill
  • 14.5k
  • 3
  • 53
  • 132
Loading
Source Link
Nathan Merrill
  • 14.5k
  • 3
  • 53
  • 132
Loading