Rename variable 'comp' to 'complement' for clarity

This commit is contained in:
2026-01-24 15:46:45 +05:30
committed by GitHub
parent 6363aeaed3
commit 686d174f19
+1 -1
View File
@@ -2,7 +2,7 @@ public:
vector<int> twoSum(vector<int>& nums, int target){
unordered_map<int,int>hash;
for(int i=0;i<nums.size();++i){
int comp = target - nums[i];
int complement = target - nums[i];
if(hash.find(complement) != hash.end(){
return {hash[complement],i};
hash[nums[i]] = i;