© 2023 Hashnode

#hashmap

Data Structures and Algorithms are an essential part of coding interviews in many companies most Big Tech companies(Example:-Google, Microsoft, Apple, Amazon, etc….) types ask it for the selection of the ideal SDE and it is not only limite…

class Solution { public: int majorityElement(vector<int> &nums) ////Boyer Moore method O(n) TC O(1) SC { int majorityelement; int count = 0; for (int i = 0; i < nums.s…

Leetcode problem: https://leetcode.com/problems/two-sum/ Problem Statement Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You…

Hello guys! Welcome back to the Leetcode Daily series. I apologize for the inconsistent blogs, I've been busy moving to a new city for my first-ever in-office internship! Wish me luck, tomorrow's my f…

Leetcode problem: https://leetcode.com/problems/longest-substring-without-repeating-characters/description/ Problem Statement Given a string s, find the length of the longest substring without repeati…

Overview Hash table is a data structure that provides extremely fast data search, O(1) for most cases. Under the hood, hash table exploits the fact that looking an item up in an array takes constant time once you have an index. Hash table i…

Overview Dictionary is an abstract data structure that stores a collection of (key, value) pairs. It may also be called an associative array or map(e.g. Map in Java). Each key is unique and the data type of key or value can be arbitrary. Di…

TL;DR: Never use mutable objects as the keys to your HashMap! After I wrote my article How does HashMap work in Java? a few people suggested more topics HashMap. Thus, I decided to make a short serie…

The Problem This problem is described: Two strings are considered close if you can attain one from the other using the following operations: Operation 1: Swap any two existing characters. For examp…

Alright, let's get straight in and understand how exactly the internal implementation of HashMaps is done in Java. Not going to bore you with yet another explanation of what hashing is and what hash m…