Day - 41

Day - 41

Hello, dear ones! Today I am writing day 41 of my 100-day challenge! Are you interested in what problems have been solved today? If this is of interest to you, continue reading the article!


Learning or doing something little by little is more effective than you think! You will not only learn new things, but you will also train yourself to do some kind of training regularly.


Let's start coding!


  1. Problem 219. Contains Duplicate II

var containsNearbyDuplicate = function (nums, k) 
  const hashmap = new Map();
  let index = 0,
    len = nums.length;

  while (index < len) {
    if (index - hashmap.get(nums[index]) <= k) {
      return true;
    }
    hashmap.set(nums[index], index);
    index++;
  }
  return false;
};        

That's all for today! Thanks for your attention! I am glad to post this day! Take care, ideas!


#coding #solutions #problems #leetcode #algorithms #javascript #typescript #like #share

要查看或添加评论,请登录

社区洞察

其他会员也浏览了