0531-0540 531. Lonely Pixel I $\star\star$ 532. K-diff Pairs in an Array $\star$ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20class Solution { public: int findPairs(vector<int>& nums, int k) { if (k < 0) return 0; int ans = 0; unordered_map<int, int> map; for (int i = 0; i < nums.size(); ++i) map[nums[i]] = i; for (int i = 0; i < nums.size(); ++i) { int target = nums[i] + k; if (map.count(target) && map[target] != i) { ++ans; map.erase(target); } } return ans; } }; 533. Lonely Pixel II $\star\star$ 534. Game Play Analysis III $\star\star$ 535. Encode and Decode TinyURL $\star\star$ 536. Construct Binary Tree from String $\star\star$ 537. Complex Number Multiplication $\star\star$ 538. Convert BST to Greater Tree $\star$ 539. Minimum Time Difference $\star\star$ 540. Single Element in a Sorted Array $\star\star$