I have an Array {1,2,3,4,4,5,3} . I want to know how many duplicate values are t

I have an Array {1,2,3,4,4,5,3} . I want to know how many duplicate values are there in that Array and the output should return the unique duplicate values like {3,4}. Is there a function to gets this output?

OriginalPostID-144331

OriginalPostID-144331

  Discussion posts and replies are publicly visible

Parents
  • I would suggest doing it this way:

    load(
    local!array: {1,2,3,4,4,5,3},
    union(local!array,local!array)
    )

    You can also use rule!APN_distinct in place of the union() function if you have the common objects installed. If you want to know how many duplicate items there are, just do something like this:

    load(
    local!array: {1,2,3,4,4,5,3},
    length(
    local!array
    ) - length(
    union(
    local!array,
    local!array
    )
    )
    )
Reply
  • I would suggest doing it this way:

    load(
    local!array: {1,2,3,4,4,5,3},
    union(local!array,local!array)
    )

    You can also use rule!APN_distinct in place of the union() function if you have the common objects installed. If you want to know how many duplicate items there are, just do something like this:

    load(
    local!array: {1,2,3,4,4,5,3},
    length(
    local!array
    ) - length(
    union(
    local!array,
    local!array
    )
    )
    )
Children
No Data