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 Python
This problem is about finding the first non-repeating character in a string. For example, if the input string is "GeeksforGeeks", then the output should be 'f '.
About this solution: The candidate's solution is correct and uses a dictionary to store the characters and their counts. The time complexity of this solution is O(n) because the dictionary is iterated over once. The space complexity of this solution is O(n) because the dictionary is the same size as the input string.
Dec 01
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This problem asks us to find the first non-repeating character in a given string. For example, if the string is "GeeksforGeeks", then the first non-repe ating character is 'f'.
About this solution: The candidate's solution is correct and uses a dictionary to store the characters and their counts. 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 input string.
Nov 29
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem asks you to write a function that takes in an array of integers and returns true if any element appears more than once in the array. Otherwise, the function should return false.
About this solution: This is a great solution! The candidate has used a hash set to keep track of unique elements in the array as they iterate through it. This is an efficient way to solve the problem with a time complexity of O(n).
Nov 27
Code Problem / Data Structures and Algorithms DifficultyMedium C#
This problem is asking for the indices of two numbers in an array that add up to a given target. For example, if the array is [2, 7, 11, 15] and the target is 9, the solution would be [0, 1] because 2 + 7 = 9.
About this solution: The candidate's solution is complete and solves the problem. The candidate's approach is to use a dictionary to store each number in the array and its index. Then, for each number, the candidate checks if the dictionary contains the number needed to sum to the target. If so, the candidate returns the indices of the two numbers. Otherwise, the candidate adds the number to the dictionary.
Nov 25
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
Given an array of integers and a target value, return the indices of the two numbers in the array that add up to the target value.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The candidate's approach is also correct. The candidate's solution has a time complexity of O(n) and a space complexity of O(n).
Nov 25
Code Problem / Data Structures and Algorithms DifficultyMedium Python
This function checks whether a given linked list is a palindrome. If the linked list is 1 -> 2 -> 3 -> 2 -> 1, the function will return True.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The approach is to reverse the linked list and compare it to the original. This is optimal because it only requires one pass through the linked list.
Nov 23
Code Problem / Data Structures and Algorithms DifficultyMedium C#
The problem asks for a sum of integers that are hashed to odd values. An example input is given, and the expected output is 9.
About this solution: The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The candidate's approach is to simply declare a namespace and a class, but does not provide any actual implementation.
Nov 23
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
Given a list of integers and a target sum, this problem determines whether any two integers in the list sum to the target sum. For example, given the input [1, 2, 3 , 4, 5] and target sum = 9, the output would be true because 4 + 5 = 9.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The solution uses a hash table to store the values of the array, which allows for checking if the complement of the current value is in the hash table. If it is, then the candidate has found a pair that sums to the target sum. The solution has a time complexity of O(n) and a space complexity of O(n).
Nov 20