Retired

Non-consecutive Pairs (retired)

Description:

Write a function to identify all non-consecutive pairs in an array.

The function should return a nested array of pairs.

Example # 1

non_consec_pairs(['a', 'b', 'c'])
=> [['a', 'c']]

In this example 'a' & 'b' are consecutive, as are 'b' & 'c'.

Leaving only one non-consecutive pairing that can be made; 'a' & 'c'.

Example # 2

non_consec_pairs([1, 2, 3, 4])
=> [[1, 3], [1, 4], [2, 4]]

Note

The input will always be flat a array but the contents and size will vary

Arrays
Fundamentals

Stats:

CreatedAug 1, 2017
Warriors Trained136
Total Skips31
Total Code Submissions160
Total Times Completed34
Ruby Completions34
Total Stars1
% of votes with a positive feedback rating67% of 18
Total "Very Satisfied" Votes10
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes4
Total Rank Assessments18
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • thegoodnate Avatar
Ad