From d4286d0b42ff5d9fbdc6c13d27057dd11ed194aa Mon Sep 17 00:00:00 2001 From: RISHAV KUMAR Date: Sat, 20 Jan 2018 11:35:43 +0530 Subject: [PATCH 1/3] Interview questions --- algorithms/hash.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 algorithms/hash.md diff --git a/algorithms/hash.md b/algorithms/hash.md new file mode 100644 index 00000000..68b9ea79 --- /dev/null +++ b/algorithms/hash.md @@ -0,0 +1,17 @@ +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. From f785cf4021c705f404f32d1a23fea1d700dacf6b Mon Sep 17 00:00:00 2001 From: RISHAV KUMAR Date: Sat, 20 Jan 2018 20:02:54 +0530 Subject: [PATCH 2/3] Interview Questions --- algorithms/hash-table.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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. From aba0cad4e3cc9d373e12de4de55dd2c3b2c3a4b7 Mon Sep 17 00:00:00 2001 From: RISHAV KUMAR Date: Sat, 20 Jan 2018 20:04:26 +0530 Subject: [PATCH 3/3] Interview questions --- algorithms/hash-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms/hash-table.md b/algorithms/hash-table.md index a92aeb83..f4490a01 100644 --- a/algorithms/hash-table.md +++ b/algorithms/hash-table.md @@ -8,7 +8,7 @@ Hash Table Interview Questions on Hashing Techniques -Longest Consecutive Subsequence... +1.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.