{"id":12922,"date":"2021-09-30T16:30:36","date_gmt":"2021-09-30T11:00:36","guid":{"rendered":"https:\/\/python-programs.com\/?p=12922"},"modified":"2021-11-22T18:33:35","modified_gmt":"2021-11-22T13:03:35","slug":"python-program-to-find-a-number-repeating-and-missing-in-an-array-or-list","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-a-number-repeating-and-missing-in-an-array-or-list\/","title":{"rendered":"Python Program to Find a Number Repeating and Missing in an Array or List"},"content":{"rendered":"

Enhancing programming skills is very important no matter what language you have chosen. So, practice frequently with these simple java programs<\/a> examples and excel in coding the complex logic.<\/p>\n

The task is to discover the missing and recurring numbers in the given n-dimensional array or list. The array’s values are in the inclusive range from 1 to n.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list = [2, 6, 4, 5, 4, 3]<\/pre>\n

Output:<\/strong><\/p>\n

The element which is repeating in the given list [2, 6, 4, 5, 4, 3] is [ 4 ]\r\nThe missing element in the given list [2, 6, 4, 5, 4, 3] is [ 1 ]<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given list =[7, 1, 3, 7, 2, 5, 8, 6]<\/pre>\n

Output:<\/strong><\/p>\n

The element which is repeating in the given list [7, 1, 3, 7, 2, 5, 8, 6] is [ 7 ]\r\nThe missing element in the given list [7, 1, 3, 7, 2, 5, 8, 6] is [ 4 ]<\/pre>\n

Program to Find a Number Repeating and Missing in an Array or List in Python<\/h2>\n

Below are the ways to find a number repeating and missing in the given list.<\/p>\n