LeetCode Username
ayan_9819
Problem Number, Title, and Link
https://leetcode.com/problems/smallest-missing-non-negative-integer-after-operations/submissions/1803627202
Bug Category
Problem description
Bug Description
- Smallest Missing Non-negative Integer After Operations
Language Used for Code
Java
Code used for Submit/Run operation
class Solution {
public int findSmallestInteger(int[] nums, int value) {
int[] freq = new int[value];
for (int a : nums) {
int r = ((a % value) + value) % value;
freq[r]++;
}
int x = 0;
while (true) {
int r = x % value;
if (freq[r] == 0) return x;
freq[r]--;
x++;
}
}
}
Expected behavior
6
ms
Beats
84.77%
Screenshots
Additional context
No response