Python solution 🐍
from typing import List, Dict def non_consecutive(numbers: List[int]) -> List[Dict]: result: List[Dict] = [] last_number = numbers[0] for index, current_number in enumerate(numbers[1:], start=1): if not current_number - 1 == last_number: result.append({'i': index, 'n': number}) last_number = number return result
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Python solution 🐍