Add office photos
Hike logo
Employer?
Claim Account for FREE

Hike

3.6
based on 56 Reviews
Filter interviews by

80+ Hike Interview Questions and Answers

Updated 21 Feb 2025
Popular Designations

Q1. Design an photo viewing app which will show images from the disk in the list, and one item in the list should take half of the screen. (Android app design question, have to explain all the components used in it...

read more
Ans.

An Android photo viewing app with a list of images from disk, one taking half the screen.

  • Use RecyclerView to display the list of images

  • Use a custom adapter to bind the images to the RecyclerView

  • Use a GridLayoutManager with span count of 2 to achieve the half-screen effect

  • Load images from disk using a library like Glide or Picasso

  • Implement click listeners to handle item selection and display the selected image

View 1 answer
right arrow

Q2. Rearrange Linked List Problem Statement

Given a singly linked list in the form 'L1' -> 'L2' -> 'L3' -> ... 'Ln', your task is to rearrange the nodes to the form 'L1' -> 'Ln' -> 'L2' -> 'Ln-1', etc. You must not...read more

Ans.

Rearrange the nodes of a singly linked list in a specific order without altering the data of the nodes.

  • Use two pointers to split the linked list into two halves.

  • Reverse the second half of the linked list.

  • Merge the two halves alternately to rearrange the nodes.

  • Ensure to handle cases with odd and even number of nodes separately.

  • Example: For input 1 -> 2 -> 3 -> 4 -> 5, the output should be 1 -> 5 -> 2 -> 4 -> 3.

Add your answer
right arrow
Hike Interview Questions and Answers for Freshers
illustration image

Q3. Find Missing Number In String Problem Statement

You have a sequence of consecutive nonnegative integers. By appending all integers end-to-end, you formed a string S without any separators. During this process, ...read more

Ans.

Given a string of consecutive nonnegative integers without separators, find the missing integer.

  • Iterate through all possible splits of the string and check if the sequence is valid

  • If the sequence is valid, return the missing integer

  • Handle cases where there are multiple missing integers or the string is invalid

Add your answer
right arrow

Q4. LRU Cache Design Question

Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:

1. get(key) - Return the value of the key if it exists in the cache; otherwise, re...read more

Ans.

Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraint.

  • Implement a doubly linked list to keep track of the order of keys based on their recent usage.

  • Use a hashmap to store key-value pairs for quick access and update.

  • When capacity is reached, evict the least recently used item before inserting a new item.

  • Update the order of keys in the linked list whenever a key is accessed or updated.

Add your answer
right arrow
Discover Hike interview dos and don'ts from real experiences

Q5. You have to design screen in which at a time on screen 10 nearest restaurants will be shown in a list. The screen will keep adding more options while scrolling. Scroll in the list should be uninterrupted as pos...

read more
Ans.

Design a screen to show 10 nearest restaurants in a list with uninterrupted scrolling.

  • Use a RecyclerView to display the list of restaurants

  • Implement a custom adapter to populate the data in the list

  • Use a location service to get the user's current location

  • Sort the restaurants based on their distance from the user's location

  • Load more restaurants as the user scrolls to the end of the list

Add your answer
right arrow

Q6. Palindrome Permutation - Problem Statement

Determine if a permutation of a given string S can form a palindrome.

Example:

Input:
string S = "aab"
Output:
"True"
Explanation:

The permutation "aba" of the string ...read more

Ans.

Check if a permutation of a string can form a palindrome.

  • Create a frequency map of characters in the string.

  • Check if at most one character has an odd frequency.

  • If yes, return True; otherwise, return False.

Add your answer
right arrow
Are these interview questions helpful?

Q7. Reverse Words in a String: Problem Statement

You are given a string of length N. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more

Ans.

Reverse words in a string by reversing the order of words while maintaining spaces.

  • Split the input string by spaces to get individual words

  • Reverse the order of the words

  • Join the reversed words with a single space in between

Add your answer
right arrow

Q8. You have application which shows list of all contacts, the Name/Numbers can be duplicated. How will you go on and do searching in this. Search term can either exist in Name or in Number.

Ans.

To search for contacts with duplicate names or numbers, iterate through the list and compare each contact's name and number with the search term.

  • Iterate through the list of contacts

  • Compare the search term with each contact's name and number

  • Return the contacts that match the search term

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. Average Marks Problem Statement

Given the initial letter of a student's name and three integer marks for that student, calculate and display the student's initial letter followed by the integer part of their av...read more

Ans.

Calculate and display the student's initial letter followed by the integer part of their average marks.

  • Calculate the average of the three marks provided for each student.

  • Display the initial letter of the student's name followed by the integer part of the average marks.

  • Round down the average to the nearest integer to get the integer part.

Add your answer
right arrow

Q10. You have application which shows list of all contacts, the Name can be duplicated, also it can contain duplicated numbers (0XXXXX, XXXXX etc). How will you go on and do searching in this. Search term can either...

read more
Ans.

To search for contacts with duplicate names and numbers, create a search function that checks both fields.

  • Create a function that takes a search term as input

  • Iterate through the list of contacts

  • Check if the search term exists in the Name field or Num field

  • Return the contacts that match the search term

Add your answer
right arrow

Q11. Java/Android : Given an Object 'Ball'. How will you transfer this ball object from one thread to another. Same ball object pass from Thread to MainThread.

Ans.

To transfer the Ball object from one thread to another, we can use Handler or AsyncTask.

  • Use Handler to post a Runnable to the main thread's message queue

  • Use AsyncTask to perform background operations and update the UI on the main thread

  • Pass the Ball object as a parameter or use a shared variable between threads

Add your answer
right arrow

Q12. Maximum Size Rectangle Sub-matrix with All 1's Problem Statement

You are provided with an N * M sized binary matrix 'MAT' where 'N' denotes the number of rows and 'M' denotes the number of columns. Your task is...read more

Ans.

Find the maximum area of a submatrix with all 1's in a binary matrix.

  • Iterate over each cell in the matrix and calculate the maximum area of submatrix with that cell as the top-left corner.

  • Use dynamic programming to keep track of the maximum width of 1's ending at each cell.

  • Update the maximum area as you iterate through the matrix.

  • Return the maximum area found.

Add your answer
right arrow

Q13. K Largest Elements Problem Statement

Given an unsorted array containing 'N' integers, you are required to find 'K' largest elements from the array and return them in non-decreasing order.

Input:

The first line ...read more
Ans.

Find K largest elements in an unsorted array and return them in non-decreasing order.

  • Sort the array in non-decreasing order

  • Return the last K elements of the sorted array

Add your answer
right arrow

Q14. Minimum Number of Swaps to Sort an Array

Find the minimum number of swaps required to sort a given array of distinct elements in ascending order.

Input:

T (number of test cases)
For each test case:
N (size of the...read more
Ans.

The minimum number of swaps required to sort a given array of distinct elements in ascending order.

  • Use a graph-based approach to find cycles in the array for swapping

  • Count the number of swaps needed to sort the array

  • Example: For [4, 3, 2, 1], 2 swaps are needed to sort it to [1, 2, 3, 4]

Add your answer
right arrow

Q15. Next Greater Number Problem Statement

Given a string S which represents a number, determine the smallest number strictly greater than the original number composed of the same digits. Each digit's frequency from...read more

Ans.

Given a number represented as a string, find the smallest number greater than the original with the same set of digits.

  • Sort the digits in non-increasing order to find the next greater number.

  • Swap the last two digits to get the smallest greater number.

  • If no greater number exists, return -1.

Add your answer
right arrow

Q16. If you were asked to make your own HashMap, how will you do it. (As it was used in the first question)

Ans.

To create my own HashMap, I would use an array of linked lists to handle collisions and implement key-value pairs using a hash function.

  • Create an array of linked lists to store the key-value pairs

  • Implement a hash function to generate an index for each key

  • Handle collisions by adding elements to the linked list at the corresponding index

  • Support operations like put(key, value), get(key), and remove(key)

Add your answer
right arrow

Q17. Binary Tree Maximum Path Sum Problem Statement

Determine the maximum path sum for any path in a given binary tree with 'N' nodes.

Note:

  • A 'path' is defined as any sequence of adjacent nodes connected by an edg...read more
Ans.

Find the maximum path sum in a binary tree with 'N' nodes.

  • Traverse the binary tree to find the maximum path sum.

  • Keep track of the maximum sum encountered so far.

  • Consider all possible paths in the tree to find the maximum sum.

  • Example: For input 1 2 3 4 -1 5 6 -1 -1 -1 -1 -1 -1, the maximum path sum is 16.

Add your answer
right arrow

Q18. Level Order Traversal Problem Statement

Given a binary tree of integers, return the level order traversal of the binary tree.

Input:

The first line contains an integer 'T', representing the number of test cases...read more
Ans.

Return the level order traversal of a binary tree given in level order with null nodes represented by -1.

  • Parse the input to create the binary tree using level order traversal

  • Use a queue to perform level order traversal and print the nodes in the order visited

  • Handle null nodes represented by -1 appropriately

Add your answer
right arrow

Q19. Peak Element Finder

For a given array of integers arr, identify the peak element. A peak element is an element that is greater than its neighboring elements. Specifically, if arr[i] is the peak, then both arr[i...read more

Ans.

Find the peak element in an array of integers.

  • Iterate through the array and check if the current element is greater than its neighbors.

  • Handle edge cases for the first and last elements of the array.

  • Return the peak element found.

Add your answer
right arrow

Q20. Statistics From A Large Sample Task

Calculate various statistical measures given a large sample of integers in the range [0, 255]. For efficiency, you are provided with an array 'count' where the i-th element s...read more

Ans.

Calculate various statistical measures given a large sample of integers in the range [0, 255] using the provided frequency array.

  • Iterate through the 'count' array to calculate minimum and maximum values.

  • Calculate the mean by summing up all values and dividing by the total count.

  • Find the median by sorting the sample and determining the middle element(s).

  • Identify the mode by finding the element with the highest frequency.

  • Ensure precision up to 5 decimal places in the output.

Add your answer
right arrow

Q21. You have to design screen in which at a time on screen 10 nearest restaurants will be shown in a list. How will you go on design this. (Need to keep UI as un interrupted as possible).

Ans.

Design a screen to show 10 nearest restaurants in a list while keeping the UI uninterrupted.

  • Use a scrollable list view to display the restaurants

  • Implement a location-based search algorithm to find the nearest restaurants

  • Include a search bar to allow users to search for specific restaurants

  • Display relevant information for each restaurant such as name, rating, and distance

  • Implement filters or sorting options to allow users to customize the list

  • Consider using a map view to show ...read more

Add your answer
right arrow

Q22. Maximum Sum Path in a Binary Tree

Your task is to determine the maximum possible sum of a simple path between any two nodes (possibly the same) in a given binary tree of 'N' nodes with integer values.

Explanati...read more

Ans.

Find the maximum sum of a simple path between any two nodes in a binary tree.

  • Use a recursive approach to traverse the binary tree and calculate the maximum sum path.

  • Keep track of the maximum sum path found so far while traversing the tree.

  • Consider negative values in the path sum calculation to handle cases where the path can skip nodes.

  • Update the maximum sum path if a new path with a higher sum is found.

Add your answer
right arrow

Q23. Infix to Postfix Conversion

Convert a given infix expression, represented as a string EXP, into its equivalent postfix expression.

Explanation:

An infix expression is formatted as a op b where the operator is p...read more

Ans.

Convert infix expression to postfix expression.

  • Use a stack to keep track of operators and operands.

  • Follow the rules of precedence for operators.

  • Handle parentheses to ensure correct order of operations.

Add your answer
right arrow

Q24. Pair Sum in Binary Search Tree

Given a Binary Search Tree (BST) and a target value 'K', determine if there exist two unique elements in the BST such that their sum equals the target 'K'.

Explanation:

A BST is a...read more

Ans.

Given a BST and a target value, determine if there exist two unique elements in the BST such that their sum equals the target.

  • Traverse the BST in-order to get a sorted array of elements.

  • Use two pointers approach to find the pair sum in the sorted array.

  • Keep track of visited elements to ensure uniqueness.

  • Handle edge cases like null nodes and empty tree.

  • Example: For input BST [20, 10, 35, 5, 15, 30, 42, -1, 13, -1, -1, -1, -1, -1, -1, -1] and K = 45, output true.

Add your answer
right arrow

Q25. Maximum Difference in Matrix

Given an n x n matrix mat[n][n] of integers, find the maximum value of mat[c][d] - mat[a][b] for all possible indices where c > a and d > b.

Input:

The first line contains a single ...read more
Ans.

Find the maximum difference between elements in a matrix with specific conditions.

  • Iterate through all possible pairs of indices (a, b) and (c, d) where c > a and d > b.

  • Calculate the difference between mat[c][d] and mat[a][b] for each pair.

  • Keep track of the maximum difference found so far.

  • Return the maximum difference as the final result.

Add your answer
right arrow

Q26. Maximum Size Rectangle Sub-Matrix with All 1's

Given an N x M binary matrix 'MAT', where N is the number of rows and M is the number of columns, determine the maximum area of a submatrix consisting entirely of ...read more

Ans.

Find the maximum area of a submatrix consisting entirely of 1's in a binary matrix.

  • Iterate over each cell in the matrix and calculate the maximum area of a submatrix with that cell as the top-left corner.

  • Use dynamic programming to keep track of the maximum width of 1's ending at each cell in the current row.

  • Update the maximum area as you iterate through the matrix and consider each cell as the bottom-right corner of the submatrix.

Add your answer
right arrow

Q27. Prefix to Infix Conversion

Transform a string representing a valid Prefix expression, which may contain operators '+', '-', '*', '/', and uppercase letters, into its corresponding Infix expression.

Example:

Inp...read more
Ans.

Convert a valid Prefix expression to its corresponding Infix expression.

  • Use a stack to store operands and operators while traversing the prefix expression from right to left.

  • Pop operands from the stack and form the infix expression by placing them between corresponding operators.

  • Handle the precedence of operators to ensure correct order of operations in the infix expression.

Add your answer
right arrow
Q28. How can you pass a simple Java object from one thread to another?
Ans.

Use a Handler or AsyncTask to pass a Java object between threads.

  • Use a Handler to send messages containing the object from one thread to another.

  • Use AsyncTask to perform background tasks and update UI with the object on the main thread.

Add your answer
right arrow

Q29. how does looper/handlers work internally when you pass object from one thread to another.

Ans.

Looper/handlers allow passing objects between threads in Android.

  • Looper is a message loop that runs in a thread and processes messages from a message queue.

  • Handlers are used to send messages to the message queue of a looper.

  • When an object is passed from one thread to another using a handler, it is encapsulated in a message and added to the receiving thread's message queue.

  • The receiving thread's looper then processes the message and delivers it to the handler's callback method...read more

Add your answer
right arrow

Q30. Given an array, which consist of natural numbers only. The elements are in random order, tell the first missing natural number in the array. e.g 4,6,3,1,6,8 o.p - 2 1,2,3 O/P - 4

Ans.

Given an array of natural numbers, find the first missing natural number.

  • Sort the array and iterate through it to find the first missing number.

  • Use a hash set to keep track of the numbers present in the array.

  • The first missing number will be the smallest positive integer not present in the array.

Add your answer
right arrow

Q31. Number of Islands II Problem Statement

You have a 2D grid of dimensions 'N' rows by 'M' columns, initially filled with water. You are given 'Q' queries, where each query contains two integers 'X' and 'Y'. Durin...read more

Ans.

The task is to determine the number of islands present on a 2D grid after each query of converting water to land.

  • Create a function that takes the grid dimensions, queries, and coordinates as input.

  • For each query, convert the water at the given coordinates to land and update the grid.

  • Use depth-first search (DFS) to find connected lands and count the number of islands.

  • Return the number of islands after each query.

Add your answer
right arrow

Q32. Ninja and Sorted Array Merging Problem

Ninja is tasked with merging two given sorted integer arrays ARR1 and ARR2 of sizes 'M' and 'N', respectively, such that the merged result is a single sorted array within ...read more

Ans.

Merge two sorted arrays into one sorted array within the first array.

  • Create a pointer for the last index of ARR1 and ARR2 to start merging from the end.

  • Compare elements from both arrays and place the larger element at the end of ARR1.

  • Continue this process until all elements are merged in sorted order within ARR1.

Add your answer
right arrow

Q33. Reverse Alternate Levels of a Perfect Binary Tree Problem Statement

Given a perfect binary tree consisting of 'N' nodes, reverse the nodes at alternate levels in the tree (i.e., reverse level 2, level 4, level ...read more

Ans.

Reverse alternate levels of a perfect binary tree by reversing nodes at even levels starting from level 2.

  • Traverse the tree in level order and store nodes at even levels in a separate list.

  • Reverse the list of nodes at even levels.

  • Update the tree with the reversed nodes at even levels.

  • Repeat the process for alternate levels starting from level 2.

Add your answer
right arrow
Q34. How would you design an ImageDownloader that efficiently handles parallel API calls?
Ans.

Use a thread pool to handle parallel API calls efficiently.

  • Implement a thread pool to manage multiple threads for downloading images concurrently.

  • Use a caching mechanism to store downloaded images and avoid redundant API calls.

  • Consider using a priority queue to prioritize important images for download.

  • Implement a mechanism to cancel or pause ongoing downloads if needed.

  • Optimize network requests by batching multiple requests together.

Add your answer
right arrow

Q35. Design a weather app. (One image for every weather is there on a server) Take care of half downloaded image, try not to consume data of user again.

Ans.

A weather app that displays images for different weather conditions, taking care of half downloaded images and minimizing data consumption.

  • Implement image caching to store downloaded images locally

  • Check if the image is already downloaded before making a network request

  • Use a progress bar to indicate the download status of the image

  • Handle cases where the download is interrupted or incomplete

  • Implement a mechanism to resume the download from where it left off

  • Optimize image loadin...read more

Add your answer
right arrow

Q36. Given an Object 'Ball'. How will you transfer this ball object from one thread to another in Android.

Ans.

To transfer the Ball object from one thread to another in Android, we can use Handler or AsyncTask.

  • Use Handler to post the Ball object from one thread to another

  • Create a Handler in the receiving thread and use its post() method to receive the Ball object

  • Alternatively, use AsyncTask to perform the transfer in the background thread and update the UI thread with the Ball object

Add your answer
right arrow

Q37. Binary Tree Traversals

Your task is to compute the In-Order, Pre-Order, and Post-Order traversals for a given Binary Tree with 'N' nodes, where each node has an integer value.

Input:
T For each test case, the i...read more
Ans.

Compute In-Order, Pre-Order, and Post-Order traversals for a given Binary Tree with 'N' nodes.

  • Implement tree traversal algorithms: In-Order, Pre-Order, and Post-Order.

  • Use recursion to traverse the binary tree efficiently.

  • Handle null nodes represented by -1 in the input.

  • Follow the order of nodes as they appear in the level order traversal.

  • Ensure the output is space-separated lists for each traversal type.

Add your answer
right arrow
Q38. What are the different launch modes for activities in Android?
Ans.

Different launch modes for activities in Android control how the activity is launched and how it interacts with the existing activities in the back stack.

  • Standard: The default launch mode where a new instance of the activity is created every time it is launched.

  • SingleTop: If the activity is already at the top of the back stack, it will not be recreated and onNewIntent() will be called instead.

  • SingleTask: The activity will have a unique instance in the back stack, and if it is...read more

Add your answer
right arrow

Q39. Sorting of a Rotated Sorted Array Problem Statement

You are provided with a rotated sorted array of size N. Your task is to sort the given array in increasing order.

Example:

Input:
N = 4
Array = [2, 3, 4, 1]
Ou...read more
Ans.

Implement a function to sort a rotated sorted array in increasing order without using the sort() function.

  • Find the pivot element in the rotated sorted array.

  • Split the array into two subarrays based on the pivot element.

  • Sort each subarray separately.

  • Merge the sorted subarrays to get the final sorted array.

Add your answer
right arrow
Q40. What is the difference between deep links and app links?
Ans.

Deep links are URLs that take users directly to specific content within an app, while app links are URLs that open an app if it's installed, or redirect to a website if not.

  • Deep links are used to navigate users to a specific location within an app, bypassing the home screen.

  • App links are URLs that can open an app if it's installed on the device, or redirect to a website if the app is not installed.

  • Deep links require specific handling in the app to properly navigate to the des...read more

Add your answer
right arrow
Q41. What are the IPC mechanisms available in Android OS?
Ans.

Inter-Process Communication (IPC) mechanisms in Android OS allow different processes to communicate with each other.

  • Binder: High-performance mechanism for IPC between processes in Android. Used for communication between system services and applications.

  • Intent: Used for communication between components within the same application or between different applications.

  • Content Providers: Allow different applications to share data through a common interface.

  • Broadcast Receivers: Used ...read more

Add your answer
right arrow

Q42. Running Median Problem

Given a stream of integers, calculate and print the median after each new integer is added to the stream.

Output only the integer part of the median.

Example:

Input:
N = 5 
Stream = [2, 3,...read more
Ans.

Calculate and print the median after each new integer is added to the stream.

  • Use two heaps - a max heap to store the smaller half of the numbers and a min heap to store the larger half.

  • Keep the sizes of the two heaps balanced to efficiently calculate the median.

  • If the total number of elements is odd, the median will be the top element of the max heap.

  • If the total number of elements is even, the median will be the average of the top elements of the two heaps.

Add your answer
right arrow

Q43. What are the different android components and concepts such as Recycler View, View Model, ANR and how do they function internally?

Ans.

Android components like Recycler View, View Model, ANR are essential for building robust Android applications.

  • Recycler View: Efficient way to display large data sets by recycling views as they scroll off the screen.

  • View Model: Manages UI-related data in a lifecycle-conscious way, surviving configuration changes.

  • ANR (Application Not Responding): Dialog shown to the user when the main thread of an app is blocked for too long.

  • Understanding how these components work internally is...read more

Add your answer
right arrow

Q44. Given a cartesian x-y plane and lot of points in that plane with x and y coordinates and 1 more point(say x,y) is given, so we have to find all the points in that plane which are lying in a radius of length r f...

read more
Ans.

Given a point and a radius, find all points in a cartesian plane within the radius.

  • Calculate the distance between the given point and all other points in the plane using the distance formula.

  • If the distance is less than or equal to the radius, add the point to the result set.

  • Return the result set of points within the radius of the given point.

Add your answer
right arrow

Q45. Design the ImageDownloader, with efficiently handling parallel API calls.

Ans.

ImageDownloader efficiently handles parallel API calls.

  • Use a thread pool to manage parallel API calls.

  • Implement caching to avoid redundant API calls.

  • Use a priority queue to prioritize image downloads.

  • Optimize network requests by using HTTP/2 or multiplexing.

  • Consider using a library like Picasso or Glide for image loading and caching.

Add your answer
right arrow
Q46. You have 5 pirates and 100 gold coins. The challenge is to determine how the pirates will divide the coins among themselves based on their ranking and the rules they follow.
Ans.

5 pirates must divide 100 gold coins based on ranking and rules.

  • Pirate 1 proposes a distribution, all pirates (including the proposer) vote on it. If majority agree, coins are distributed. If not, Pirate 1 is thrown overboard and Pirate 2 proposes a new distribution.

  • Pirates are ranked by seniority, with Pirate 1 being the most senior.

  • Pirates prioritize staying alive over getting gold, but also want to maximize their share of gold.

  • Example: Pirate 1 proposes 98 coins for himsel...read more

Add your answer
right arrow

Q47. How do you do DeepLinking in android.

Ans.

Deep linking in Android allows users to navigate directly to specific content within an app.

  • Deep linking is achieved by defining intent filters in the app's manifest file.

  • The intent filter specifies the URL scheme and host that the app can handle.

  • When a deep link is clicked, Android checks if any app can handle the URL and prompts the user to choose.

  • The chosen app receives the deep link data in the intent's data field.

  • Deep linking can be used to open specific screens, perform...read more

Add your answer
right arrow
Q48. What is a Cyclic Barrier in Java?
Ans.

CyclicBarrier in Java is a synchronization aid that allows a set of threads to wait for each other to reach a common barrier point.

  • CyclicBarrier is initialized with a count of the number of threads that must invoke await() before the barrier is tripped.

  • Threads wait at the barrier until all threads have invoked await(), then the barrier is released.

  • Once the barrier is tripped, it can be reused for subsequent synchronization points.

  • CyclicBarrier can be used in scenarios where m...read more

Add your answer
right arrow

Q49. how you will find out 3rd smallest element from an array

Ans.

To find the 3rd smallest element from an array, sort the array and return the element at index 2.

  • Sort the array in ascending order

  • Return the element at index 2

  • If the array has less than 3 elements, return null

Add your answer
right arrow
Q50. Explain the Producer-Consumer problem and how it can be solved using semaphores.
Ans.

Producer-Consumer problem involves multiple threads sharing a common buffer. Producers add items to the buffer while consumers remove them.

  • Producers and consumers need to synchronize their access to the shared buffer to avoid race conditions.

  • Semaphores can be used to control access to the buffer. Two semaphores are used - one to track the empty slots in the buffer and one to track the filled slots.

  • Producers increment the empty semaphore count when they add an item to the buff...read more

Add your answer
right arrow

Q51. Design a photo viewer app (Technical architecture) for android device.

Ans.

A photo viewer app for Android devices.

  • Use RecyclerView to display a grid of photos

  • Implement a caching mechanism to improve performance

  • Support gestures for zooming and swiping between photos

  • Integrate with a cloud storage service for photo storage and retrieval

  • Implement a search feature to allow users to find specific photos

Add your answer
right arrow
Q52. What is an IntentService?
Ans.

IntentService is a subclass of Service that can handle asynchronous requests on the main thread.

  • IntentService is used for handling long-running operations in the background without blocking the main thread.

  • It is started with an Intent and runs in a separate worker thread.

  • Once the task is completed, the IntentService stops itself automatically.

  • It is commonly used for tasks like downloading files, syncing data, or performing network operations.

Add your answer
right arrow
Q53. What are the characteristics of distributed file systems?
Ans.

Characteristics of distributed file systems include scalability, fault tolerance, and data replication.

  • Scalability: Distributed file systems can easily scale to accommodate a large amount of data and users.

  • Fault tolerance: They are designed to continue functioning even if some components fail, ensuring high availability.

  • Data replication: Data is often replicated across multiple nodes to ensure reliability and performance.

  • Consistency: Distributed file systems must maintain con...read more

Add your answer
right arrow
Q54. How do you analyze the usage history of an application?
Ans.

Analyzing usage history involves tracking user interactions, patterns, and trends to improve application performance.

  • Collect and store user interaction data such as clicks, page views, and time spent on each feature.

  • Use analytics tools to generate reports and visualize usage patterns.

  • Identify popular features, user preferences, and areas for improvement based on usage data.

  • Implement A/B testing to compare different versions of features and analyze user behavior.

  • Utilize machin...read more

Add your answer
right arrow

Q55. What is STLC and how you work in different layers of it?

Ans.

STLC stands for Software Testing Life Cycle. It is a process used to test software applications from planning to deployment.

  • STLC consists of phases like requirement analysis, test planning, test design, test execution, and test closure.

  • As a Senior Software Quality Engineer, I work in different layers of STLC by creating test plans, designing test cases, executing tests, and analyzing results.

  • I collaborate with developers, product managers, and other stakeholders to ensure hig...read more

Add your answer
right arrow

Q56. What is Hr To manage business Hr basic rules? Processing, Planing, price

Ans.

HR is the management of human resources to achieve business goals.

  • HR involves recruiting, training, and managing employees.

  • HR policies and procedures ensure compliance with laws and regulations.

  • HR also includes compensation and benefits management.

  • Effective HR planning can help organizations achieve their objectives.

  • HR analytics can provide insights into workforce trends and performance.

Add your answer
right arrow

Q57. Designing a LRU Cache which is thread safe and can be scaled

Ans.

Design a thread-safe LRU cache that can be scaled.

  • Use a ConcurrentHashMap to ensure thread safety.

  • Implement a doubly linked list to keep track of the least recently used items.

  • Use a HashMap to store the cache items for fast retrieval.

  • Implement a size limit for the cache and remove the least recently used item when the limit is reached.

  • To scale the cache, use a distributed cache like Redis or Memcached.

Add your answer
right arrow

Q58. Write code to get maximum and second maximum element of a stack. The given function should be in O(1) complexity

Ans.

Code to get max and second max element of a stack in O(1) complexity.

  • Create two variables to store max and second max values

  • Update the variables whenever a new element is pushed or popped from the stack

  • Return the max and second max values when required

Add your answer
right arrow

Q59. Given a biotonic array ( first numbers increase and then decrease ) write code to search a given number. Time complexity O(logn)

Ans.

Code to search a given number in a biotonic array with O(logn) time complexity.

  • Use binary search to find the peak element in the array.

  • Divide the array into two subarrays and perform binary search on each subarray.

  • Return the index of the element if found, else return -1.

Add your answer
right arrow
Q60. Why are synchronized blocks needed in Java?
Ans.

Synchronized blocks are needed in Java to ensure thread safety by allowing only one thread to access a block of code at a time.

  • Prevents multiple threads from accessing critical sections of code simultaneously

  • Ensures data consistency and prevents race conditions

  • Improves performance by reducing contention for shared resources

  • Example: synchronized block in a method that updates a shared variable

Add your answer
right arrow

Q61. Launch Mode of Activity in Android

Ans.

Launch mode determines how a new instance of an activity is created and added to the task stack.

  • Standard: Creates a new instance of the activity each time it is launched.

  • SingleTop: If an instance of the activity already exists at the top of the stack, it will be reused.

  • SingleTask: If an instance of the activity already exists in the stack, it will be brought to the front and cleared of any activities above it.

  • SingleInstance: The activity will be launched in a new task and no ...read more

Add your answer
right arrow

Q62. How does Stack work internally and what data it holds?

Ans.

Stack is a data structure that follows LIFO (Last In First Out) principle.

  • Stack holds a collection of elements

  • It has two main operations: push (adds element to top) and pop (removes element from top)

  • It also has peek operation (returns top element without removing it)

  • Stack can be implemented using arrays or linked lists

  • Examples: undo-redo functionality in text editors, back-forward navigation in web browsers

Add your answer
right arrow

Q63. Launch Mode of Activity.

Ans.

Launch mode determines how an activity is launched and how it behaves in the task stack.

  • Standard: Creates a new instance of the activity on each launch.

  • SingleTop: Reuses the existing instance if it's already at the top of the stack.

  • SingleTask: Creates a new task and places the activity at the root of the task.

  • SingleInstance: Creates a new task and places the activity as the only one in the task.

Add your answer
right arrow

Q64. Experience on huge infrastructure, how to make decisions of scaling, performance and availability?

Ans.

Scaling, performance, and availability decisions on huge infrastructure require a data-driven approach.

  • Analyze data on usage, traffic, and resource utilization to identify bottlenecks and areas for improvement.

  • Consider the impact of scaling on cost, user experience, and maintenance.

  • Implement monitoring and alerting systems to quickly identify and address issues.

  • Use load testing and performance profiling to optimize system performance.

  • Implement redundancy and failover mechanis...read more

Add your answer
right arrow

Q65. do you know spell checker in micro soft word

Ans.

Yes, spell checker is a built-in feature in Microsoft Word.

  • Spell checker automatically checks for spelling errors as you type.

  • It underlines misspelled words in red and suggests corrections.

  • You can also customize the spell checker settings and add words to the dictionary.

  • To access the spell checker, go to the Review tab and click on Spelling & Grammar.

  • Alternatively, you can use the shortcut key F7 to run the spell checker.

Add your answer
right arrow

Q66. A sorted array is rotated K times. Sort it in o(n) traversal without extra space

Ans.

Sort a rotated sorted array in O(n) time without extra space

  • Find the index of the minimum element using binary search

  • Reverse the two subarrays on either side of the minimum element

  • Reverse the entire array

  • Example: [4,5,6,7,0,1,2] -> [0,1,2,4,5,6,7]

Add your answer
right arrow

Q67. Write the test cases regarding Facebook posts and set their priorities.

Ans.

Test cases for Facebook posts with priorities

  • Verify that a user can create a new post

  • Check that a user can edit their own post

  • Ensure that a user can delete their own post

  • Test that a user can like a post

  • Verify that a user can comment on a post

Add your answer
right arrow

Q68. Write the test cases to delete a node from a linked list

Ans.

Test cases to delete a node from a linked list

  • Test deleting the first node in the linked list

  • Test deleting a node in the middle of the linked list

  • Test deleting the last node in the linked list

  • Test deleting a node that does not exist in the linked list

Add your answer
right arrow

Q69. two pair with a given sum in a bst with o(log n) space

Ans.

Finding two pairs with a given sum in a BST using O(log n) space.

  • Traverse the BST in-order and store the nodes in an array

  • Use two pointers approach to find the pairs with the given sum

  • Time complexity: O(n), Space complexity: O(log n)

  • Optimized approach: Use two stacks to traverse the BST in-order and find the pairs

  • Time complexity: O(log n), Space complexity: O(log n)

Add your answer
right arrow

Q70. K random numbers from infinite stream of array with equal probability

Ans.

To select k random numbers from an infinite stream of array with equal probability.

  • Use reservoir sampling algorithm to randomly select k numbers from the stream

  • Maintain a reservoir array of size k to store the selected numbers

  • For each incoming number, generate a random number between 0 and the total count of numbers seen so far

  • If the generated number is less than k, replace the corresponding number in the reservoir array with the incoming number

  • At the end, the reservoir array...read more

Add your answer
right arrow

Q71. How to debug a full functionality of an API

Ans.

Debugging a full functionality of an API involves thorough testing, logging, and using debugging tools.

  • Start by reviewing the API documentation to understand its functionality and expected behavior.

  • Write test cases to cover all possible scenarios and edge cases.

  • Use logging to track the flow of data and identify any issues.

  • Utilize debugging tools like Postman, Swagger, or browser developer tools to inspect API requests and responses.

  • Check for error messages and status codes to...read more

Add your answer
right arrow

Q72. How to analyze usage history of a application

Ans.

Usage history of an application can be analyzed by tracking user actions and behavior.

  • Collect data on user interactions with the application

  • Analyze the frequency and duration of usage

  • Identify patterns and trends in user behavior

  • Use data visualization tools to present findings

  • Consider user feedback and reviews for additional insights

Add your answer
right arrow
Q73. What is ConcurrentHashMap in Java?
Ans.

ConcurrentHashMap is a thread-safe implementation of the Map interface in Java.

  • ConcurrentHashMap allows multiple threads to read and write to the map concurrently without causing any issues like deadlocks or data corruption.

  • It achieves thread-safety by dividing the map into segments, each of which can be locked independently.

  • ConcurrentHashMap is more efficient than using synchronized maps for concurrent access.

  • Example: ConcurrentHashMap<String, Integer> map = new ConcurrentHa...read more

Add your answer
right arrow

Q74. How would you launch a new onboarding experience UI

Ans.

I would launch a new onboarding experience UI by conducting user research, designing a user-friendly interface, testing with a small group, and gradually rolling out to all users.

  • Conduct user research to understand user needs and pain points

  • Design a user-friendly interface with clear instructions and intuitive navigation

  • Test the new onboarding experience with a small group of users to gather feedback and make improvements

  • Gradually roll out the new UI to all users while monito...read more

Add your answer
right arrow

Q75. Methods of IPC in android.

Ans.

IPC (Inter-Process Communication) methods in Android allow communication between different processes.

  • Binder: Android's default IPC mechanism, provides high-performance communication between processes.

  • AIDL (Android Interface Definition Language): Used to define the programming interface for IPC using Binder.

  • Intents: Used for asynchronous communication between components within an application or between different applications.

  • Content Providers: Allow sharing data between applic...read more

Add your answer
right arrow
Q76. Design a file sharing mechanism between two users.
Ans.

Design a file sharing mechanism between two users.

  • Implement a secure login system for both users.

  • Allow users to upload files to a shared server.

  • Provide a way for users to view and download files shared by the other user.

  • Implement access control to ensure only authorized users can access the shared files.

Add your answer
right arrow

Q77. Designing a file sharing mechanism between two users

Ans.

Design a file sharing mechanism between two users

  • Use a secure protocol like HTTPS or SFTP

  • Implement access control to ensure only authorized users can access the files

  • Consider implementing encryption to protect the files during transit and at rest

  • Provide a user-friendly interface for uploading and downloading files

  • Implement version control to track changes made to the files

  • Consider implementing a notification system to alert users of new file uploads or changes

Add your answer
right arrow

Q78. Implement Inorder Traversal with and without using recursion

Ans.

Inorder Traversal can be implemented using recursion or without recursion.

  • Inorder Traversal using recursion involves traversing the left subtree, visiting the root node, and then traversing the right subtree.

  • Inorder Traversal without recursion involves using a stack to keep track of the nodes to be visited.

  • For each node, push it onto the stack and traverse its left subtree until there are no more left nodes.

  • Pop the top node from the stack, visit it, and then traverse its righ...read more

Add your answer
right arrow

Q79. Write the Test Cases about Amazon Gift Card

Ans.

Test cases for Amazon Gift Card

  • Verify that the gift card balance is correctly displayed

  • Test redeeming a gift card code

  • Check if multiple gift cards can be applied to a single purchase

  • Ensure that expired gift cards are not accepted

  • Test the functionality of sending a gift card to someone else

Add your answer
right arrow

Q80. Reverse alternate levels of a binary tree

Ans.

Reverse alternate levels of a binary tree

  • Traverse the tree level by level

  • Reverse the nodes of alternate levels

  • Use a queue or stack to keep track of nodes at each level

  • Recursively apply the same process to the children of reversed nodes

Add your answer
right arrow

Q81. Implement an LRU cache

Ans.

LRU cache is a data structure that stores the most recently used items, discarding the least recently used items when full.

  • Use a hashmap to store key-value pairs for quick access

  • Use a doubly linked list to keep track of the order of items based on their usage

  • When an item is accessed, move it to the front of the list

  • When the cache is full, remove the least recently used item from the end of the list

Add your answer
right arrow

Q82. Why manhole is round ?

Ans.

Manholes are round because it prevents them from falling into the hole and allows for easy movement of the cover.

  • Round covers cannot fall into the hole as they cannot fit through diagonally

  • Round covers can be easily moved in any direction

  • Round shape distributes weight evenly

  • Round shape is easier to manufacture and install

Add your answer
right arrow

Q83. Explain the architecture of transformer models.

Add your answer
right arrow

Q84. Median of a stream of array

Ans.

Finding the median of a stream of array in real-time.

  • Use two heaps to keep track of the median

  • Maintain a max heap for the lower half and a min heap for the upper half

  • If the heaps are balanced, the median is the average of the top elements of both heaps

  • If the heaps are unbalanced, the median is the top element of the heap with more elements

Add your answer
right arrow

Q85. Largest vertical rectangle in array

Ans.

Find the largest vertical rectangle in an array of strings

  • Iterate through each column in the array

  • For each column, find the consecutive vertical rectangles of '1's

  • Calculate the area of each rectangle and keep track of the largest one

Add your answer
right arrow

Q86. Lru Cache leet problem in deep

Ans.

Implement a Least Recently Used (LRU) cache

  • Use a combination of a doubly linked list and a hashmap to efficiently implement the LRU cache

  • When a new element is accessed, move it to the front of the linked list and update the hashmap

  • When the cache is full, remove the least recently used element from the end of the linked list and the hashmap

Add your answer
right arrow

Q87. Sell a water bottle

Ans.

Stay hydrated on the go with our durable and stylish water bottle.

  • Highlight the durability of the water bottle

  • Emphasize the convenience of staying hydrated while on the go

  • Mention the stylish design to appeal to fashion-conscious customers

Add your answer
right arrow

Q88. Sell a laptop cover

Ans.

Protect your laptop in style with our sleek and durable laptop cover.

  • Made from high-quality materials to ensure maximum protection

  • Available in various sizes to fit different laptop models

  • Stylish designs to suit your personal taste

  • Easy to clean and maintain for long-lasting use

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at Hike

based on 9 interviews
Interview experience
3.9
Good
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

WNS Logo
3.4
 • 279 Interview Questions
HSBC Group Logo
4.0
 • 245 Interview Questions
American Express Logo
4.2
 • 191 Interview Questions
Bajaj Auto Logo
3.9
 • 152 Interview Questions
Senco Gold Logo
4.5
 • 138 Interview Questions
Fujitsu Logo
3.8
 • 135 Interview Questions
View all
Recently Viewed
INTERVIEWS
BNY
200 top interview questions
SALARIES
TCS
DESIGNATION
DESIGNATION
SALARIES
TCS
SALARIES
Ernst & Young
SALARIES
Standard Chartered
SALARIES
Boston Scientific
REVIEWS
Omega Healthcare
No Reviews
SALARIES
HCLTech
Top Hike Interview Questions And Answers
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter