Gulshan Kumarperfinsights.hashnode.dev·Mar 23, 2024Decode the MessageYou are given the strings key and message, which represent a cipher key and a secret message, respectively. The steps to decode message are as follows: Use the first appearance of all 26 lowercase English letters in key as the order of the substitut...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Mar 12, 2024Custom Sort StringYou are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously. Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs ...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Mar 12, 2024Count Elements With Maximum FrequencyYou are given an array nums consisting of positive integers. Return the total frequencies of elements in nums such that those elements all have the maximum frequency. The frequency of an element is the number of occurrences of that element in the arr...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Mar 12, 2024Kth Distinct String in an ArrayA distinct string is a string that is present only once in an array. Given an array of strings arr, and an integer k, return the k<sup>th</sup> distinct string present in arr. If there are fewer than k distinct strings, return an empty string "". Not...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·Mar 12, 2024Count Common Words With One OccurrenceGiven two string arrays words1 and words2, return the number of strings that appear exactly once in each of the two arrays. LeetCode Problem - 2085 class Solution { public int countWords(String[] words1, String[] words2) { // Variable to ...DiscussJava SolutionJava
The Paritosh KumarforSPACEtheparitoshkumar.com·Mar 7, 2024Solving the Two Sum Problem Efficiently Using Hash TablesIntroduction The Two Sum problem is a classic algorithmic problem that involves finding two numbers in an array that add up to a specific target value. While a brute-force approach exists, it's often inefficient for larger arrays due to its quadratic...DiscussData Structures and Algorithms array
Siddhant Prakashsiddhantexplainstech.hashnode.dev·Feb 26, 2024Mastering Concurrent Programming: A Deep Dive into Concurrent HashMapConcurrent Hashmap Java Collections provides various data structures for working with key-value pairs. The commonly used ones are - Hashmap (Non-Synchronised, Not Thread Safe) discuss the Synchronized Hashmap method Hashtable (Synchronised, Threa...DiscussJava Journey Series: Mastering the LanguageJava
Luis Puentesluispuentes.hashnode.dev·Feb 20, 2024Golang - Add Elements to one map position// declare the hashMap var hashMap = make(map[int][]string) hashMap[123] = []string{"123"} // adding elements to the HashMap hashMap[123] = append(hashMap[123], "abc") hashMap[123] = append(hashMap[123], "456") fmt.Println(hashMap)// map[123:[123 a...DiscussGo Language
Manupuri Nithinnithinmanupuri.hashnode.dev·Feb 12, 2024HashMap in Java: Enhancements and Features Beyond Java 8As we know HashMap is a data structure implements the Map Interface and is primarily used to store key-value pairs in a hash table. The beauty of HashMap's lies in their ability to perform retrieval operations with constant-time complexity. In HashMa...Discusshashmap
Arpit Rathorearpitrathore.com·Feb 12, 2024Longest Substring Without Repeating Characters3. Longest Substring Without Repeating Characters Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example ...DiscussTop interview questions two pointers