Skip to content

Files

Latest commit

Zanger67/leetcodeZanger67/leetcode
Zanger67/leetcode
and
Zanger67/leetcode
Mar 16, 2025
03398f8 · Mar 16, 2025

History

History
47 lines (34 loc) · 1016 Bytes

_1748. Sum of Unique Elements.md

File metadata and controls

47 lines (34 loc) · 1016 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : June 06, 2024

Last updated : July 01, 2024


Related Topics : Array, Hash Table, Counting

Acceptance Rate : 78.81 %


Solutions

C

// Brute forcey based on constraints but eh twas simpler
// Plus consistently 100% runtime with typically good % memory

int sumOfUnique(int* nums, int numsSize) {
    short ref[101] = {0};

    int sum = 0;
    for (int i = 0; i < numsSize; i++) {
        ref[nums[i]]++;
    }

    int output = 0;
    for (int i = 0; i < 101; i++) {
        if (ref[i] == 1) {
            output += i;
        }
    }
    return output;
}