Forgot password
 Register account
View 457|Reply 0

找出列表中重复的元素的位置

[Copy link]

3222

Threads

7841

Posts

52

Reputation

Show all posts

hbghlyj posted 2021-6-30 17:04 |Read mode
Last edited by hbghlyj 2021-6-30 17:53FindDuplicates =
Function[x, Module[{counts}, counts = Select[Counts[x], # > 1 &];
   Flatten[Position[x, #]] & /@ Keys[counts]]]
示例
S = RandomInteger[{1, 1000}, 2000];
FindDuplicates[S]

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-21 22:10 GMT+8

Powered by Discuz!

Processed in 0.013085 seconds, 23 queries