Hashing

Categories: Code Problem / Data Structures and Algorithms / Recursion (32) Code Problem / Data Structures and Algorithms / Binary Search (30) Code Problem / Data Structures and Algorithms / Linked Lists (26) Code Problem / Data Structures and Algorithms / Backtracking (26) Code Problem / Data Structures and Algorithms / Stacks and Queues (25) Code Problem / Data Structures and Algorithms / Hashing (24) Databases / SQL / Backup and Recovery (19) Code Problem / Data Structures and Algorithms / Arrays and Strings (19) Databases / SQL / Database Normalization (18) Code Problem / Data Structures and Algorithms / Time Complexity (17) Databases / SQL / Locking (16) Databases / SQL / Replication (15) Databases / SQL / SQL Queries (13) Code Problem / Data Structures and Algorithms / Graphs (13) Databases / SQL / Database Security (13)  More...

Recent solutions:

Check these solutions from our community:
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem asks us to write a function that takes in a string and returns True if the string has all unique characters, and False if it does not.
About this solution: The candidate's solution is correct and uses a HashSet to store the characters, which is an efficient way to check for duplicates.
Nov 20
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem asks for the implementation of a hash table in Java. The input is a set of keys to be stored in the hash table, and the output is the hash table containing the keys .
About this solution: The candidate's solution is correct and uses an efficient data structure (a dictionary) to implement the hash table.
Nov 18
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given a string, this function returns the first non-repeating character in the string. For example, given the input string "abcab", the function would return "c".
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The solution uses a dictionary to store the number of times each character appears in the string and then iterates through the string to find the first character that appears only once. The solution is optimal because it only iterates through the string once.
Nov 18
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given an array of integers, the "Two Sum" problem is to find the indices of two numbers in the array that add up to a given target. There is always a unique solution to this problem.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The solution uses a dictionary to store the values of the array and uses the dictionary to check if the complement of the current value is in the dictionary. If it is, then the indices of the complement and the current value are returned. The time complexity of this solution is O(n) because the dictionary is iterated through once. The space complexity of this solution is O(n) because the dictionary is the same size as the array.
Nov 09
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem asks whether a given list of integers contains a pair of numbers whose sum equals a given target value. For example, if the list is [1, 2, 3, 4, 5] and the target value is 6, the answer would be True (1 + 5 = 6).
About this solution: This is a great solution! The candidate has thought through the problem and come up with an optimal solution.
Nov 09
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem can be solved using a hashing approach. We can iterate through the array, adding each element to a hash table. Then, for each element, we can check if there is another element in the array that adds up to the target number. If so, we return the indices of the two numbers.
About this solution: This is a great solution! The candidate has thought about the problem and come up with a solution that is both complete and efficient. The candidate has also taken the time to explain the thought process behind the solution.
Nov 08
Code Problem / Data Structures and Algorithms DifficultyMedium Python
Given an array of integers and a value k, print all pairs that sum to k.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The approach is sound and the candidate has correctly identified the time and space complexity of the solution.
Nov 08
Code Problem / Data Structures and Algorithms DifficultyMedium Python
The Two-Sum Hashing problem is to find two numbers in an array that add up to a given target number. This can be solved using a hash table, which stores the array elements and their corresponding indices. To find two numbers that add up to the target, we can iterate through the array, and check if the complement (target - array[i]) exists in the hash table. If it does, then we have found our two numbers.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The solution uses a hash table to store the numbers in the array and then checks if the target minus the number is in the hash table. If it is, then the two numbers that add up to the target are found. This solution is optimal because it is O(n) time complexity and O(n) space complexity.
Nov 06