mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
correct comments of C version of Leetcode349
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user