C++ // Counting Sort // "Handle empty array"
JeninSutradhar opened this issue · 0 comments
JeninSutradhar commented
Counting Sort C++
C++ implementation is mostly correct but it does not handle the case where the input array is empty.
if (nums == null || nums.length == 0) {
return; // handle empty array
}
Add a check at the beginning to return immediately if the input array is empty or null.