Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6564 |

@blackshadows | 6400 |

@mb1973 | 5785 |

@Quandray | 5275 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 5074 |

@kirtidee18 | 4639 |

@sanjay05 | 3762 |

@mantu_singh | 3712 |

@gfgaccount | 3627 |

@marius_valentin_dragoi | 3525 |

Complete Leaderboard | |

Handle | Score |

@yaswanthero123 | 625 |

@vikash619 | 611 |

@venkat11803610 | 501 |

@roshan13ar | 396 |

@DevangSingh | 379 |

@ravi11815721 | 312 |

@hrishipangavhane | 286 |

@aryanjain85297 | 280 |

@kommaraju11806903 | 277 |

@infosumitraut | 272 |

@ankitsharma5422 | 256 |

Complete Leaderboard |

There are total **n** tasks given to a group of 5 students in a class. Three of those five students completed **m** tasks of their choices and left the group. Now the burden of completing remaining tasks is on the two students Tanya and Manya. Suppose the **n** tasks are in an array form **1,2,3,...n**. Tanya and Manya decided to complete their remaining tasks in the following manner :- First of the remaining task is done by Tanya and the next remaining one by Manya . For example if **n **= 10 and **m **= 4 and the completed 4 tasks are {2, 3, 5, 7} then the reamining tasks are {1, 4, 6, 8, 9, 10} so, Tanya completes {1, 6, 9} tasks and Manya completes {4, 8, 10} tasks and thereby completing the **n** tasks given.

Given **n**, **m** and the indexes (1 for first task, 2 for second task and so on..) of completed tasks, find the tasks which Tanya and Manya have to complete.

**Example 1:**

**Input:
**n = 15, m = 6
arr[] = {2, 5, 6, 7, 9, 4}
**Output:**
1 8 11 13 15
3 10 12 14
**Explanation:** The remaining tasks are :
{1, 3, 8, 10, 11, 12, 13, 14, 15}.
So Tanya should take these tasks :
{1, 8, 11, 13, 15}.
And Manya should take these tasks :
{3, 10, 12, 14}.

**Example 2:**

**Input:
**n = 4, m = 3
arr[] = {2, 4, 3}
**Output:**
1
**Explanation:** There are no task for Manya.

**Your Task:**

You don't need to read input or print anything. Your task is to complete the function **findTasks()** which takes the array of integers **arr, m** and **n **as parameters and returns a pair of an array of integers denoting the answer.

**Expected Time Complexity:** O(n)

**Expected Auxiliary Space:** O(n)

**Constraints:**

1 ≤ m ≤ n ≤ 10^{5}

1 ≤ arr[i] ≤ n

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Completing tasks

...