आसान 0 हल किए गए 0% स्वीकृति

Remove Duplicates

Keep only the first occurrence of each value.

Return the list with repeated values removed, keeping the first occurrence of each value in its original order.

Implement remove_duplicates(numbers).

Input

numbers: The list of integers.

Output

Return the list without duplicates.

सीमाएँ

0 ≤ length ≤ 100,000

उदाहरण

उदाहरण 1
इनपुट:
numbers = [3, 1, 3, 2, 1]

अपेक्षित आउटपुट:
expected = [3, 1, 2]
इनपुट:
std::vector<long long> numbers = {3, 1, 3, 2, 1};

अपेक्षित आउटपुट:
std::vector<long long> expected = {3, 1, 2};
इनपुट:
long[] numbers = new long[] {3, 1, 3, 2, 1};

अपेक्षित आउटपुट:
long[] expected = new long[] {3, 1, 2};

व्याख्या

Keep 3, 1, then 2; the later 3 and 1 are dropped: [3, 1, 2].

उदाहरण 2
इनपुट:
numbers = [7, 7, 7]

अपेक्षित आउटपुट:
expected = [7]
इनपुट:
std::vector<long long> numbers = {7, 7, 7};

अपेक्षित आउटपुट:
std::vector<long long> expected = {7};
इनपुट:
long[] numbers = new long[] {7, 7, 7};

अपेक्षित आउटपुट:
long[] expected = new long[] {7};

व्याख्या

Only the first 7 stays: [7].

संदर्भ

यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

दूसरों से सीखें

समुदाय समाधान

अभी तक कोई प्रकाशित समाधान नहीं। पहला साझा करने के लिए इस चुनौती को हल करें।