Given an array of size N-1 such that it only contains distinct integers in the range of 1 to N. Find the missing element.
Example 1:
Input:N = 5A[] = {1,2,3,5}Output: 4
Discussion posts and replies are publicly visible
alternate approach ->
a!localVariables( local!list: { 1, 2, 3, 4, 5, 6, 9, 8, 10, 11 }, local!n: length(local!list) + 1, (local!n * (local!n + 1)) / 2 - sum(local!list) )