Reported September 2026
Agodahash table

Count Values Appearing Exactly Once

Reported by candidates from Agoda's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Agoda OA. Under 2s to a working solution.
Founder's read

Agoda reported this one in September 2026, and it's a lot simpler than the wording suggests. Strip the phrasing and you're counting how many values show up exactly one time. That's a frequency count, nothing more. If you've got an OA invite for Agoda, expect easy-tier problems like this to be a warm-up or a speed check, so the risk isn't difficulty, it's overthinking. Read it once, write the hash map, move on. And if your head goes blank under the timer, StealthCoder runs invisibly during the live OA and hands you the solution as a safety net.

The problem

Given an integer array nums, return how many distinct values occur exactly once in the array.
A value contributes one to the answer only when its total frequency is one. Values that occur two or more times do not contribute.

Function
countAppearingOnce(nums: int[]) → int

Examples
Example 1
nums = [4,2,1,4,4,1,3]
return = 2
Only 2 and 3 appear exactly once.
Example 2
nums = [7,7,7]
return = 0
The only value occurs three times.
Example 3
nums = [-1,0,5]
return = 3
Every value occurs once.

Constraints
1 <= nums.length <= 10^5.
-10^9 <= nums[i] <= 10^9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The whole problem reduces to one question: how many keys in a frequency map have a count of 1? Build a hash map from value to count in one pass over nums, then loop over the counts and tally the ones equal to 1. That's O(n) time and O(n) space, and with n up to 10^5 it's trivially fast. The common pitfall is counting the wrong thing. Some people return the number of distinct values, or the sum of counts, or they decrement and increment a counter inconsistently. Another trap is sorting and comparing neighbors, which works but gets fiddly at the array edges. Negative values and the 10^9 range don't matter with a hash map, so don't reach for a fixed-size array. If you blank mid-assessment, StealthCoder is the hedge: it reads the problem on screen and gives you the clean map solution while staying hidden from the proctor.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Count Values Appearing Exactly Once cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Agoda's OA.

Agoda reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Count Values Appearing Exactly Once FAQ

How hard is the Agoda Count Values Appearing Exactly Once problem really?+

It's easy. The task is a single frequency count followed by a tally of values with count one. If you know how to use a hash map or dictionary in your language, you can finish it in a few minutes. The only real risk is a careless mistake on the final count.

What's the trick to solving it?+

There's no real trick. Count occurrences of each value, then count how many have a frequency of exactly 1. Don't count distinct values and don't sum frequencies. Keep the two steps separate and the logic stays clean and hard to get wrong.

Can I solve it without a hash map?+

Yes. Sort the array, then scan and check each run of equal values. A value counts if its run length is 1. That's O(n log n) time with little extra space. The hash map is faster and simpler to write, so use it unless you're told to avoid extra memory.

Do negative numbers or large values break anything?+

No. Values range from -10^9 to 10^9, which is why a fixed-size count array won't work directly. A hash map handles any integer key. Just don't assume values are small or non-negative when picking your data structure.

How should I prepare in 48 hours for an Agoda OA with this kind of question?+

Get fast at frequency-map problems and basic array patterns. Write this one from scratch twice, including edge cases like all duplicates and all unique. Then spend the remaining time on a couple of medium problems so you aren't thrown if the next question is harder.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Agoda.

OA at Agoda?
Invisible during screen share
Get it