# Category: Hash Table

## Print Processes and its messages from a given log file

Problem Statement:  There is an application that has several processes running in parallel and each process prints the logs in a single log file. Log message contains the process name, timestamp, message type (WARN,...

## Find two elements whose sum is closest to zero

Objective: Given an array of positive and negative integers, write a algorithm to find the two elements such their sum is closest to zero. Example: int a [] = {1, 4, -5, 3, -2,...

## Find the element which appears maximum number of times in the array.

Objective: Given an array of integers, write a algorithm to find the element which appears maximum number of times in the array. Example: int [] arrA = {4, 1, 5, 2, 1, 5, 9,...

## Find duplicates in an given array in O(n) time and O(1) extra space.

Objective: Given an array of integers, find out duplicates in it. Example: int [] a = {4, 6, 2, 1, 2, 5}; Output: Array has duplicates : 2 int a [] = {1, 6,...

## Find the last non repeating character in a given string.

Objective: Given a string, write an algorithm to find the last non repeating character in it. Example: String input = “algorithms tutorials” Output: ‘u’ String input = “aabbccdd” Output: No repeating character found. Approach:...

## Find the last repeating character in a given string.

Objective: Given a string, write an algorithm to find the last repeating character in it. Example: String input = “horizon tutorials” Output: ‘i’ String input = “algorithms” Output: No repeating character found. Approach: Naive...

## The Word Break Problem

Objective : Given an string and a dictionary of words, find out if the input string can be broken into a space-separated sequence of one or more dictionary words. Example: dictionary = [“I” ,...

## Find Whether Two Strings are Permutation of each other

Objective: Given Two Strings, check whether one string is permutation of other Input: Two Strings Output: True or false based on whether strings are permutation of other or not. Example: “sumit” and “tiums” are...

## Hash Table Implementation

Objective : To implement a Hash Table Input:  A set of pairs of keys and values Approach: Create a Hash Table Hashtable<Integer, String> ht = new Hashtable<Integer, String>(); Insert values in hash table using...