# Hike Interview Questions

Hike Messenger, also called Hike Sticker Chat, was an Indian freewarecross-platform instant messaging (IM), Voice over IP (VoIP) application which was launched on 12 December 2012 by Kavin Bharti Mittal and is now owned by Hike Private Limited. Hike works offline through SMS and has multi-platform support. The app registration uses standard one time password (OTP) based authentication process. Hike is estimated at a value of \$1.4 billion, with more than 100 million registered users and 350 employees.

It has got a 4.2* rating on Glassdoor and is considered one of the best product-based companies. It is highly regarded for its work-life balance.

They provide good training as well which will be beneficial in future too. You can practice the below questions collected from Hike Interview Experience for the interview. We have collected past frequently asked questions from Hike Interview Experience for your reference.

## Hike Array Questions

Question 1. Count pair with Given Sum In problem “count pair with given sum” we have given an integer array[] and another number say ‘sum’, you have to determine whether any of the two elements in a given array has a sum equal to “sum”. Example Input: arr []={1,3,4,6,7} and sum = 9. Output: “ Elements found ...

Question 2. Move all negative elements to one side of array Move all negative elements to one side of array – Suppose you have an array of integers. It consists of both negative and positive numbers and the problem statement asks to shift/move all the negative and positive elements to the left of the array and to the right of the ...

Question 3. Sum of f(a[i], a[j]) over all pairs in an array of n integers The problem statement asks to find out the Sum of f(a[i], a[j]) over all pairs in an array of n integers in such a way that 1 < = i < j < = n considering that we are provided an array of integers. Example arr[] = {1, 2, 3, ...

Question 4. Maximum difference between first and last indexes of an element in array Suppose, you have an array of integers. The problem “Maximum difference between first and last indexes of an element in array” asks to find out the difference between the first and last index of each number present in an array such that the difference is being maximum of all. Example ...

Question 5. Find all triplets with zero sum The problem “Find all triplets with zero sum” states that you are given an array containing positive and negative number both. The problem statement asks to find out the triplet with the sum equal to 0. Example arr[] = {0,-2,1,3,2,-1} (-2 -1  3) (-2 0  2) (-1 0  1) Explanation ...

Question 6. How to check if two given sets are disjoint? The problem “How to check if two given sets are disjoint?” states that suppose you are given two sets in the form of array say set1[] and set2[]. Your task is to find out whether the two sets are Disjoint Sets or not. Example inputSet1[] = {1, 15, 8, 9, ...

Question 7. First element occurring k times in an array We have given a number ‘k’ and an integer array. The problem “First element occurring k times in an array” says to find out the first element in the array which occurs exactly k times in an array. If there is no element in the array which occurs k times ...

Question 8. Non-overlapping sum of two sets Problem Statement The problem “Non-overlapping sum of two sets” states that you are given two arrays as input values as arrA[] and arrB[] of the same size n. Also, both of the arrays have distinct elements individually and some common elements. Your task is to find out the total sum ...

Question 9. Distinct adjacent elements in an array Problem Statement Suppose we have an integer array. The problem “Distinct adjacent elements in an array” asks to determine if it is possible to get the array in which all the adjacent numbers are distinct or not by swapping up two adjacent or neighbour elements in an array if it ...

Question 10. Largest Sum Contiguous Subarray Problem Statement You are given an array of integers. The problem statement asks to find out the largest sum contiguous subarray. This means nothing but to find a subarray (continuous elements) which has the largest sum among all other subarrays in the given array. Example arr[] = {1, -3, 4, ...

Question 11. Count Pairs With Given Sum Given an integer array of size n, and an integer  ‘K’, you need to count the number of pairs(need not to be unique) present in the array whose sum is equal to ‘K’. Example Input: Arr={1,  5,  7, 1} K=6 Output: 2 Brute force solution for Count Pairs With Given Sum Main idea ...

Question 12. Find a Fixed Point in a Given Array Problem Statement Given an array of n distinct elements, find a fixed point in a given array, where a fixed point means the element value is the same as the index. Example Input 5 arr[] = {0,4,8,2,9} Output 0 is a fixed point in this array because value and index ...

Question 13. Sort 0s 1s and 2s in an Array Problem Statement Given an array containing N elements where elements of the array are 0,1 or 2. Sort or Segregate 0s 1s and 2s in an array. Arrange all zeros in the first half, all ones in the second half and all twos in the third half. Example Input 22 ...

Question 14. Maximum difference between two elements such as larger element comes after smaller Problem Statement We have given an array of n integers in which we have to find the maximum difference between two elements such as larger element comes after smaller. Example Input 4  7  2  18  3  6  8  11  21 Output 19 Approach 1 for Maximum difference between two elements  ...

## Hike String Questions

Question 15. Rearrange a binary string as alternate x and y occurrences Problem Statement Suppose you are given a binary string, and two numbers x and y. The string consists of 0s and 1s only. The problem “Rearrange a binary string as alternate x and y occurrences” asks to rearrange the string such that the 0 comes x times ⇒ 1 comes ...

Question 16. Check if Two Expressions With Brackets are Same Given two strings s1 and s2 representing expressions containing addition operator, subtraction operator, lowercase alphabets, and parenthesis. Check if two expressions with brackets are the same. Example Input  s1 = “-(a+b+c)” s2 = “-a-b-c” Output  Yes Input  s1 = “a-b-(c-d)” s2 = “a-b-c-d” Output No Algorithm to Check if Two ...

Question 17. Check for Balanced Parentheses in an Expression Given a string s of length n. Check whether there is a closing parenthesis for every opening parentheses i.e. if all the parentheses are balanced. In other words, we can also say that, if we have a ‘}’, ‘)’ and ‘]’ for every ‘{‘, ‘(‘ and ‘[‘ respectively, the expression ...

Question 18. Balanced Expression with Replacement In Balanced Expression with Replacement problem we have given a string s containing parenthesis i.e. ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{‘, ‘}’. The string also contains x at some places as a replacement of parenthesis. Check if the string can be converted into an expression with valid parenthesis after replacing all ...

Question 19. Minimum Characters to be Removed to Make a Binary String Alternate Problem Statement Given a binary string, write a program that will find the minimum number of characters that can be removed from this string so that it becomes alternate. A binary string is said to be alternate if there are no consecutive 0’s or 1’s Input Format The first line ...

## Hike Tree Questions

Question 20. Boundary Traversal of binary tree Problem Statement The problem “Boundary Traversal of binary tree” states that you are given a binary tree. Now you need to print the boundary view of a binary tree. Here boundary traversal means that all the nodes are shown as the boundary of the tree. The nodes are seen from ...

Question 21. Iterative Method to find Height of Binary Tree Problem Statement The problem “Iterative Method to find Height of Binary Tree” states that you are given a binary tree, find the height of the tree using the iterative method. Examples Input 3 Input 4 Algorithm for Iterative Method to find Height of Binary Tree The height of a tree ...

Question 22. Level order traversal using two Queues Problem Statement The problem “Level order traversal using two Queues” states that you are given a binary tree, print its level order traversal line by line. Examples Input 5 11 42 7 9 8 12 23 52 3 Input 1 2 3 4 5 6 Algorithm for Level Order Traversal ...

## Hike Stack Questions

Question 23. Check if Two Expressions With Brackets are Same Given two strings s1 and s2 representing expressions containing addition operator, subtraction operator, lowercase alphabets, and parenthesis. Check if two expressions with brackets are the same. Example Input  s1 = “-(a+b+c)” s2 = “-a-b-c” Output  Yes Input  s1 = “a-b-(c-d)” s2 = “a-b-c-d” Output No Algorithm to Check if Two ...

Question 24. Check for Balanced Parentheses in an Expression Given a string s of length n. Check whether there is a closing parenthesis for every opening parentheses i.e. if all the parentheses are balanced. In other words, we can also say that, if we have a ‘}’, ‘)’ and ‘]’ for every ‘{‘, ‘(‘ and ‘[‘ respectively, the expression ...

Question 25. Balanced Expression with Replacement In Balanced Expression with Replacement problem we have given a string s containing parenthesis i.e. ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{‘, ‘}’. The string also contains x at some places as a replacement of parenthesis. Check if the string can be converted into an expression with valid parenthesis after replacing all ...

## Hike Queue Questions

Question 26. Iterative Method to find Height of Binary Tree Problem Statement The problem “Iterative Method to find Height of Binary Tree” states that you are given a binary tree, find the height of the tree using the iterative method. Examples Input 3 Input 4 Algorithm for Iterative Method to find Height of Binary Tree The height of a tree ...

Question 27. Level order traversal using two Queues Problem Statement The problem “Level order traversal using two Queues” states that you are given a binary tree, print its level order traversal line by line. Examples Input 5 11 42 7 9 8 12 23 52 3 Input 1 2 3 4 5 6 Algorithm for Level Order Traversal ...

## Hike Other Questions

Question 28. Count Primes in Ranges Problem Statement The problem “Count Primes in Ranges” states that you are given a range [left, right], where 0<=left<=right<=10000. The problem statement asks to find out the total number of prime numbers within the range. Assuming that there will be a large number of queries. Example left: 4 right:10 2 ...

Question 29. Print Fibonacci sequence using 2 variables Problem Statement The problem “Print Fibonacci sequence using 2 variables” states that you need to print the Fibonacci sequence but there is a limitation of using only 2 variables. Example n = 5 0 1 1 2 3 5 Explanation The output sequence has the first five elements of the ...

Question 30. Find Nth Node Problem Statement In the “Find Nth Node” problem we have given a linked list to find the nth node. The program should print the data value in the nth node. N is the input integer index. Example 3 1 2 3 4 5 6 3 Approach Given a linked list ...

Translate »