correct comments of C version of Leetcode349

This commit is contained in:
FrankLin
2022-04-01 11:01:00 -04:00
parent 3f7dd67a80
commit abc08b6bb6

View File

@ -294,17 +294,17 @@ int* intersection1(int* nums1, int nums1Size, int* nums2, int nums2Size, int* re
int i; int i;
//Calculate the number's counts for nums1 array /* Calculate the number's counts for nums1 array */
for(i = 0; i < nums1Size; i ++) { for(i = 0; i < nums1Size; i ++) {
nums1Cnt[nums1[i]]++; nums1Cnt[nums1[i]]++;
} }
//Check if the value existing in nums1 count array /* Check if the value in nums2 is existing in nums1 count array */
for(i = 0; i < nums2Size; i ++) { for(i = 0; i < nums2Size; i ++) {
if(nums1Cnt[nums2[i]] > 0) { if(nums1Cnt[nums2[i]] > 0) {
result[resultIndex] = nums2[i]; result[resultIndex] = nums2[i];
resultIndex ++; resultIndex ++;
//Clear this count to avoid duplicated value /* Clear this count to avoid duplicated value */
nums1Cnt[nums2[i]] = 0; nums1Cnt[nums2[i]] = 0;
} }
} }