diff --git a/algorithms/hash-table.md b/algorithms/hash-table.md index c8655047..a92aeb83 100644 --- a/algorithms/hash-table.md +++ b/algorithms/hash-table.md @@ -5,3 +5,15 @@ Hash Table - A question involving an API's integration with hash map where the buckets of hash map are made up of linked lists. - Implement data structure `Map` storing pairs of integers (key, value) and define following member functions in O(1) runtime: `void insert(key, value)`, `void delete(key)`, `int get(key)`, `int getRandomKey()`. - [Source](http://blog.gainlo.co/index.php/2016/08/14/uber-interview-question-map-implementation/). + +Interview Questions on Hashing Techniques + +Longest Consecutive Subsequence... + +Given an array of integers, find the length of the longest sub-sequence such that elements in the subsequence are consecutive integers, the consecutive numbers can be in any order. + +Examples-- + +Input: arr[] = {1, 9, 3, 10, 4, 20, 2}; Output: 4 The subsequence 1, 3, 4, 2 is the longest subsequence of consecutive elements + +Input: arr[] = {36, 41, 56, 35, 44, 33, 34, 92, 43, 32, 42} Output: 5 The subsequence 36, 35, 33, 34, 32 is the longest subsequence of consecutive elements.