Expedia Interview Questions

Expedia Interview Questions

 

Expedia Group, Inc. is an American online travel shopping company for consumer and small business travel. Its websites, which are primarily travel fare aggregators and travel metasearch engines, include Expedia.com, Vrbo, Hotels.com, Hotwire.com, Orbitz, Travelocity, trivago, and CarRentals.com.

Expedia Group has got a 4.1* rating on Glassdoor which makes it one of the best product bases companies to work for. We have collected past Expedia Interview Questions for your reference. Apart from DS & Also, they focus on System Design rounds in interviews. You can practice the below Expedia Interview Questions for your reference.

Expedia Array Questions

Question 1. Minimum Swaps to Group All 1’s Together Leetcode Solution Problem Statement Minimum Swaps to Group All 1’s Together Leetcode Solution – says that Given a binary array data, return the minimum number of swaps required to group all 1’s present in the array together in any place in the array. Input: data = [1,0,1,0,1] Output: 1 Explanation: There are 3 ways to group all ...

Read more

Question 2. Best Meeting Point LeetCode Solution Problem Statement: Best Meeting Point Leetcode Solution says – Given a m x n binary grid grid where each 1 marks the home of one friend, return the minimal total travel distance. The total travel distance is the sum of the distances between the houses of the friends and the meeting point. The distance is calculated using Manhattan Distance, ...

Read more

Question 3. Insert Delete GetRandom O(1) Leetcode Solution Problem Statement The Insert Delete GetRandom O(1) LeetCode Solution – “Insert Delete GetRandom O(1)” asks you to implement these four functions in O(1) time complexity. insert(val): Insert the val into the randomized set and return true if the element is initially absent in the set. It returns false when the ...

Read more

Question 4. Trapping Rain Water Leetcode Solution Problem Statement The Trapping Rain Water LeetCode Solution – “Trapping Rain Water” states that given an array of heights which represents an elevation map where the width of each bar is 1. We need to find the amount of water trapped after rain. Example: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: Check ...

Read more

Question 5. Unique Paths II Leetcode Solution Problem Statement The Unique Paths II LeetCode Solution – “Unique Paths II” states that given the m x n grid where a robot starts from the top left corner of the grid. We need to find the total number of ways to reach the bottom right corner of the grid. ...

Read more

Question 6. Set Matrix Zeroes Leetcode Solution Problem Statement The Set Matrix Zeroes LeetCode Solution – “Set Matrix Zeroes” states that you’re given an m x n integer matrix matrix.We need to modify the input matrix such that if any cell contains the element  0, then set its entire row and column to 0‘s. You must do it in ...

Read more

Question 7. Merge Sorted Arrays Leetcode Solution In the problem “Merge Sorted Arrays”, we are given two arrays sorted in non-descending order. The first array is not fully filled and has enough space to accommodate all elements of the second array as well. We have to merge the two arrays, such that the first array contains elements ...

Read more

Question 8. Search in Rotated Sorted Array Leetcode Solution Consider a sorted array but one index was picked and the array was rotated at that point. Now, once the array has been rotated you are required to find a particular target element and return its index. In case, the element is not present, return -1. The problem is generally ...

Read more

Question 9. Kth largest element in an Array Leetcode Solutions In this problem, we have to return the kth largest element in an unsorted array. Note that the array can have duplicates. So, we have to find the Kth largest element in the sorted order, not the distinct Kth largest element. Example A = {4 , 2 , 5 , 3 ...

Read more

Question 10. Count all subsequences having product less than K The problem “Count all subsequences having product less than K” states that you are given an array of integers. Now find the number of subsequences that have a product less than a given input K. Example a[] = {1, 2, 3, 4, 5} k = 8 Number of subsequences less ...

Read more

Question 11. k-th missing element in increasing sequence which is not present in a given sequence The problem “k-th missing element in increasing sequence which is not present in a given sequence” states that you are given two arrays. One of them is arranged in ascending order and another normal unsorted array with number k. Find the kth missing element which is not present in normal ...

Read more

Question 12. Print modified array after multiple array range increment operations The problem “Print modified array after multiple array range increment operations” states that you are given an integer array and ‘q’ numbers of queries are given. One integer value “d” is also given. Each query contains two integers, starting value and an ending value. The problem statement asks to find ...

Read more

Question 13. Array Queries for multiply replacements and product The problem “Array Queries for multiply, replacements and product” states that you are given an array of integer and there will be three types of queries, where you have to solve the following type of queries: Type 1: There will be three values left, right and a number X.In this ...

Read more

Question 14. Difference Array | Range update query in O(1) You are given an integer array and two types of queries, one is to add a given number in a range and the other to print the whole array. The problem “Difference Array | Range update query in O(1)” requires us to perform the range updates in O(1). Example arr[] ...

Read more

Question 15. Constant time range add operation on an array You have given an integer array and initially, it was initialized as 0 and also given a range. The task is to add the given number in the range of the array and print the resultant array. Example arr[] = {0, 0, 0, 0, 0} Query: {(0, 2, 50), (3, ...

Read more

Question 16. Queries on XOR of greatest odd divisor of the range Problem Statement The problem “Queries on XOR of greatest odd divisor of the range” states that you are given an array of integer and query q, each query consists of a range. The problem statement asks to find out the XOR of the greatest odd divisor within the given range ...

Read more

Question 17. Mean of range in array Problem Statement The problem “Mean of range in array” states that you are given an integer array and q number of queries. Each query contains the left and right as a range. The problem statement asks to find out the floor mean value of all the integers that come in ...

Read more

Question 18. Subset with sum divisible by m Problem Statement The problem “Subset with sum divisible by m” states that you are given an array of non-negative integers and an integer m. Now you need to find if there is a subset having sum divisible by m. That is the sum of the subset should give 0 as ...

Read more

Question 19. Best Time to Buy and Sell Stock Problem Statement The problem “Best Time to Buy and Sell Stock” states that you are given an array of prices of length n, where the ith element stores the price of stock on ith day. If we can make only one transaction, that is, to buy on one day and ...

Read more

Question 20. Shuffle 2n integers as a1-b1-a2-b2-a3-b3-..bn without using extra space Problem Statement You are given an array of integers. The problem “Shuffle 2n integers as a1-b1-a2-b2-a3-b3-..bn without using extra space” asks to shuffle all the numbers in the array such that the numbers which are like (x0, x1, x2, x3, y0, y1, y2, y3) will be shuffled like x0, y0, ...

Read more

Question 21. Maximum length subsequence with difference between adjacent elements as either 0 or 1 Problem Statement You are given an integer array. The problem “Maximum length subsequence with difference between adjacent elements as either 0 or 1” asks to find out the maximum subsequence length with the difference between the adjacent elements should be none other than 0 or 1. Example arr[] = {1, ...

Read more

Question 22. Minimum number of distinct elements after removing m items Problem Statement The problem “Minimum number of distinct elements after removing m items” states that you have an array and an integer m. Each element of the array indicates an item id’s. The problem statement asks to remove m elements in such a way that there should be a minimum ...

Read more

Question 23. Rearrange an array in order – smallest, largest, 2nd smallest, 2nd largest Problem Statement Suppose you have an integer array. The problem “Rearrange an array in order – smallest, largest, 2nd smallest, 2nd largest, ..” asks to rearrange the array in such a way that the smallest number comes first and then the largest number, then second smallest and then the second ...

Read more

Question 24. Find all permuted rows of a given row in a matrix Problem Statement Find all permuted rows of a given row in a matrix states that you are given a matrix of size m*n and a matrix row number says ‘row’. The problem statement asks to find out all the possible rows which are permutation to the given row. This is ...

Read more

Question 25. Largest rectangular sub-matrix whose sum is 0 Problem Statement Find the maximum size sub-matrix in a 2D array whose sum is zero. A sub-matrix is nothing but a 2D array inside of the given 2D array. So, you have a matrix of signed integers, you need to calculate the sum of sub-matrices and find the matrix with ...

Read more

Question 26. Count Subsets Having Distinct Even Numbers We have all struggled with the subset problem at some point or the other in an interview. The interviewers love these problems too. These problems help them examine the understanding as well as the thought process of any student. So, without any further ado let us jump straight into the ...

Read more

Question 27. Search an Element in Sorted Rotated Array In search in sorted rotated array problem we have given a sorted and rotated array and an element, check if the given element is present in the array or not. Examples Input nums[] = {2, 5, 6, 0, 0, 1, 2} target = 0 Output true Input nums[] = {2, ...

Read more

Question 28. Trapping Rain Water LeetCode Solution In the Trapping Rain Water LeetCode problem, we have given N non-negative integers representing an elevation map and the width of each bar is 1. We have to find the amount of water that can be trapped in the above structure. Example Let’s understand that by an example For the ...

Read more

Question 29. Search in Sorted Rotated Array An element search in sorted rotated array can be found using binary search in O(logn) time. The objective of this post is to find a given element in a sorted rotated array in O(logn) time. Some example of a sorted rotated array is given. Example Input : arr[] = {7,8,9,10,1,2,3,5,6}; ...

Read more

Question 30. Sort Colors Sort colors is a problem in which we have to given an array containing N objects. Each box is painted with a single color which can be red, blue, and white. We have N objects which are already painted. We have to sort the array such that the same color ...

Read more

Question 31. A Product Array Puzzle Problem Statement In a product array puzzle problem we need to construct an array where the ith element will be the product of all the elements in the given array except element at the ith position. Example Input  5 10 3 5 6 2 Output 180 600 360 300 900 ...

Read more

Question 32. Find All Pairs With a Given Difference Problem Statement We have given an array of containing different elements or no repeated elements present in the array. Find all pairs with a given difference. If there is no any pair with given different then print “No pair with given different”. Example Input 10 20 90 70 20 80 ...

Read more

Expedia String Questions

Question 33. Longest Common Prefix Leetcode Solution Problem Statement The Longest Common Prefix LeetCode Solution – “Longest Common Prefix” states that given an array of strings. We need to find the longest common prefix among these strings. If there doesn’t exist any prefix, return an empty string. Example: Input: strs = ["flower","flow","flight"] Output: "fl" Explanation: “fl” is the longest ...

Read more

Question 34. Valid Parentheses Leetcode Solution Problem Statement The Valid Parentheses LeetCode Solution – “Valid Parentheses” states that you’re given a string containing just the characters '(', ')', '{', '}', '[' and ']'. We need to determine whether the input string is a valid string or not. A string is said to be a valid string if open brackets must be closed ...

Read more

Question 35. Multiply Strings Leetcode Solution The problem Multiply Strings Leetcode solution asks us to multiply two strings which are given to us as input. We are required to print or return this result of multiplying to the caller function. So to put it more formally given two strings, find the product of the given strings. ...

Read more

Question 36. LCS (Longest Common Subsequence) of three strings The problem “LCS (Longest Common Subsequence) of three strings” states that you are given 3 strings. Find out the longest common subsequence of these 3 strings. LCS is the string that is common among the 3 strings and is made of characters having the same order in all of the ...

Read more

Question 37. Longest Substring Without Repeating Characters LeetCode Solution Longest Substring Without Repeating Characters LeetCode Solution – Given a string, we have to find the length of the longest substring without repeating characters. Let’s look into a few examples: Example pwwkew 3 Explanation: Answer is “wke” with length 3 aav 2 Explanation: Answer is “av” with length 2 Approach-1 ...

Read more

Question 38. Palindrome Substring Queries Problem Statement The problem “Palindrome Substring Queries” states that you are given a String and some queries. With those queries, you have to determine if the formed substring from that query is a palindrome or not. Example String str = "aaabbabbaaa" Queries q[] = { {2, 3}, {2, 8},{5, 7}, ...

Read more

Question 39. Maximum weight transformation of a given string Problem Statement The maximum weight transformation of a given string problem states that given a string consisting only of two characters ‘A’ and ‘B’. We have an operation where we can transform string to another string by toggling any character. Thus many transformations are possible. Out of all the possible ...

Read more

Question 40. String Compression In the String Compression problem, we have given an array a[ ] of type char. Compress it as the character and count of a particular character (if the count of character is 1 then the only character is stored in a compressed array). The length of the compressed array should ...

Read more

Question 41. Valid Parentheses LeetCode Solution In Valid Parentheses LeetCode problem we have given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid. Here we will provide a Valid Parentheses LeetCode Solution to you. An input string is valid if: Open brackets must be closed ...

Read more

Expedia Tree Questions

Question 42. Inorder Successor of a node in Binary Tree Problem Statement The problem asks to find “Inorder Successor of a node in Binary Tree”. An inorder successor of a node is a node in the binary tree that comes after the given node in the inorder traversal of the given binary tree. Example Inorder successor of 6 is 4 ...

Read more

Question 43. Minimum number of distinct elements after removing m items Problem Statement The problem “Minimum number of distinct elements after removing m items” states that you have an array and an integer m. Each element of the array indicates an item id’s. The problem statement asks to remove m elements in such a way that there should be a minimum ...

Read more

Question 44. K’th Largest element in BST using constant extra space Problem Statement “K’th Largest element in BST using constant extra space” states that you are given a binary search tree and you need to find the kth largest element in it. So if we arrange the elements of the binary search tree in descending order then we need to return ...

Read more

Expedia Stack Questions

Question 45. Trapping Rain Water Leetcode Solution Problem Statement The Trapping Rain Water LeetCode Solution – “Trapping Rain Water” states that given an array of heights which represents an elevation map where the width of each bar is 1. We need to find the amount of water trapped after rain. Example: Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] Output: 6 Explanation: Check ...

Read more

Question 46. Valid Parentheses Leetcode Solution Problem Statement The Valid Parentheses LeetCode Solution – “Valid Parentheses” states that you’re given a string containing just the characters '(', ')', '{', '}', '[' and ']'. We need to determine whether the input string is a valid string or not. A string is said to be a valid string if open brackets must be closed ...

Read more

Question 47. Trapping Rain Water LeetCode Solution In the Trapping Rain Water LeetCode problem, we have given N non-negative integers representing an elevation map and the width of each bar is 1. We have to find the amount of water that can be trapped in the above structure. Example Let’s understand that by an example For the ...

Read more

Expedia Matrix Questions

Question 48. Best Meeting Point LeetCode Solution Problem Statement: Best Meeting Point Leetcode Solution says – Given a m x n binary grid grid where each 1 marks the home of one friend, return the minimal total travel distance. The total travel distance is the sum of the distances between the houses of the friends and the meeting point. The distance is calculated using Manhattan Distance, ...

Read more

Question 49. Unique Paths II Leetcode Solution Problem Statement The Unique Paths II LeetCode Solution – “Unique Paths II” states that given the m x n grid where a robot starts from the top left corner of the grid. We need to find the total number of ways to reach the bottom right corner of the grid. ...

Read more

Question 50. Set Matrix Zeroes Leetcode Solution Problem Statement The Set Matrix Zeroes LeetCode Solution – “Set Matrix Zeroes” states that you’re given an m x n integer matrix matrix.We need to modify the input matrix such that if any cell contains the element  0, then set its entire row and column to 0‘s. You must do it in ...

Read more

Question 51. Word Search Leetcode Solution Problem Statement Given an m x n board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where “adjacent” cells are horizontally or vertically neighbouring. The same letter cell may not be used more than once. Example ...

Read more

Question 52. Find maximum length Snake sequence The problem “Find maximum length Snake sequence” states that we are provided with a grid containing integers. The task is to find a snake sequence with the maximum length. A sequence having adjacent numbers in the grid with an absolute difference of 1, is known as a Snake sequence. Adjacent ...

Read more

Question 53. Find distinct elements common to all rows of a matrix Problem Statement We are given a matrix of all the integers. The problem “Find distinct elements common to all rows of a matrix” asks to find out all the possible distinct elements but common in each of the rows present in a matrix. Example arr[]={ {11, 12, 3, 10}, {11, ...

Read more

Question 54. Find all permuted rows of a given row in a matrix Problem Statement Find all permuted rows of a given row in a matrix states that you are given a matrix of size m*n and a matrix row number says ‘row’. The problem statement asks to find out all the possible rows which are permutation to the given row. This is ...

Read more

Question 55. Largest rectangular sub-matrix whose sum is 0 Problem Statement Find the maximum size sub-matrix in a 2D array whose sum is zero. A sub-matrix is nothing but a 2D array inside of the given 2D array. So, you have a matrix of signed integers, you need to calculate the sum of sub-matrices and find the matrix with ...

Read more

Expedia Other Questions

Question 56. Break a Palindrome LeetCode Solution Problem Statement: Break a Palindrome LeetCode Solution: Given a palindromic string of lowercase English letters palindrome, replace exactly one character with any lowercase English letter so that the resulting string is not a palindrome and that it is the lexicographically smallest one possible. Return the resulting string. If there is no way to replace a character to make ...

Read more

Question 57. Find First and Last Position of Element in Sorted Array LeetCode Solution Problem Statement: Find First and Last Position of Element in Sorted Array LeetCode Solution says that – given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. You must write an algorithm with O(log n) runtime complexity. ...

Read more

Question 58. Fibonacci Number LeetCode Solution Problem Statement: Fibonacci Number LeetCode Solution says that – The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is F(0) = 0, F(1) = 1 F(n) = F(n - 1) + F(n - 2), ...

Read more

Question 59. Group Anagrams LeetCode Solution Problem Statement Group Anagrams LeetCode Solution Says that – Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1: ...

Read more

Question 60. Pairs of Songs With Total Durations Divisible by 60 LeetCode Solution Problem Statement Pairs of Songs With Total Durations Divisible by 60 LeetCode Solution – Pairs of Songs With Total Durations Divisible by 60 LeetCode Solution says that – You are given a list of songs where the ith song has a duration of time[i] seconds. Return the number of pairs of songs for which ...

Read more

Question 61. Valid Triangle Number LeetCode Solution Problem Statement Valid Triangle Number LeetCode Solution – Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Input: nums = [2,2,3,4] Output: 3 Explanation: Valid combinations are: 2,3,4 (using the first 2) ...

Read more

Question 62. Sort Colors LeetCode Solution Problem Statement Sort Colors LeetCode Solution – Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue. We will use the integers 0, 1, and 2 to represent the color red, white, and blue, respectively. ...

Read more

Question 63. Valid Triangle Number LeetCode Solution Problem Statement: Valid Triangle Number LeetCode Solution says – Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: nums = [2,2,3,4] Output: 3 Explanation: Valid combinations are: 2,3,4 (using ...

Read more

Question 64. The kth Factor of n Leetcode Solution Problem Statement The kth Factor of n Leetcode Solution: states that you are given two positive integers n and k. A factor of an integer n is defined as an integer i where n % i == 0. Consider a list of all factors of n sorted in ascending order, return the kth factor in this list or return -1 if n has less than k factors. Example 1: Input: ...

Read more

Question 65. LRU Cache Leetcode Solution Problem Statement The LRU Cache LeetCode Solution – “LRU Cache” asks you to design a data structure that follows Least Recently Used (LRU) Cache We need to implement LRUCache class that has the following functions: LRUCache(int capacity): Initializes the LRU cache with positive size capacity. int get(int key): Return the value ...

Read more

Question 66. Maximum Difference Between Increasing Elements LeetCode Solution Problem Statement Maximum Difference Between Increasing Elements LeetCode Solution – Given a 0-indexed integer array nums of size n, find the maximum difference between nums[i] and nums[j] (i.e., nums[j] - nums[i]), such that 0 <= i < j < n and nums[i] < nums[j]. Return the maximum difference. If no such i and j exists, return -1. Examples & Explanations Example 1: Input: nums = [7,1,5,4] Output: 4 Explanation: The maximum difference occurs ...

Read more

Question 67. Find Median from Data Stream LeetCode Solution Problem Statement Find Median from Data Stream LeetCode Solution – The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value and the median is the mean of the two middle values. For example, for arr = [2,3,4], the median ...

Read more

Question 68. Reformat Date LeetCode Solution Problem Statement Reformat Date LeetCode Solution – Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th", ..., "30th", "31st"}. Month is in the set {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}. Year is in the range [1900, 2100]. Convert the date string ...

Read more

Question 69. Robot Bounded In Circle LeetCode Solution Problem Statement Robot Bounded In Circle LeetCode Solution – On an infinite plane, a robot initially stands at (0, 0) and faces north. Note that: The north direction is the positive direction of the y-axis. The south direction is the negative direction of the y-axis. The east direction is the positive direction of the x-axis. The west direction is the ...

Read more

Question 70. Minimum Knight Moves LeetCode Solution Problem Statement Minimum Knight Moves LeetCode Solution – In an infinite chessboard with coordinates from -infinity to +infinity, you have a knight at square [0, 0]. A knight has 8 possible moves it can make, as illustrated below. Each move is two squares in a cardinal direction, then one square in an orthogonal direction. Return the minimum number ...

Read more

Question 71. Find the Duplicate Number LeetCode Solution Problem Statement Find the Duplicate Number LeetCode Solution – Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. You must solve the problem without modifying the array nums and uses only constant extra space. Input: nums = [1,3,4,2,2] Output: 2 Explanation ...

Read more

Question 72. Product of Array Except Self LeetCode Solution Problem Statement Product of Array Except Self LeetCode Solution – Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer. You must write an algorithm that runs in O(n) time and without using the division ...

Read more

Question 73. Top K Frequent Words LeetCode Solution Problem Statement Top K Frequent Words LeetCode Solution – Given an array of strings words and an integer k, return the k most frequent strings. Return the answer sorted by the frequency from highest to lowest. Sort the words with the same frequency by their lexicographical order. Example Test Case 1: Input: words = [“i”,”love”,”leetcode”,”i”,”love”,”coding”] k = 2 Output: [“i”,”love”] Explanation ...

Read more

Question 74. String Compression LeetCode Solution Problem Statement String Compression LeetCode Solution – Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating characters in chars: If the group’s length is 1, append the character to s. Otherwise, append the character followed by the group’s length. The compressed string ...

Read more

Question 75. Minimum Moves to Equal Array Elements LeetCode Solution Problem Statement Minimum Moves to Equal Array Elements LeetCode Solution – Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment n - 1 elements of the array by 1. Example 1: Input  1: nums = [1, 2, 3] Output: ...

Read more

Question 76. Least Number of Unique Integers after K Removals Leetcode Solution Problem Statement The Least Number of Unique Integers after K Removals LeetCode Solution – “Least Number of Unique Integers after K removals” states that you’re given an array of integers and an integer k. Find the least number of unique integers after removing exactly k elements. Example:   Input: arr = [5,5,4], k = 1 Output: 1 Explanation: Since k ...

Read more

Question 77. Move Zeroes LeetCode Solution Problem Statement The problem, Move Zeroes LeetCode Solution states that you are given an array containing zero and non-zero elements and you need to move all the zeroes to the end of the array, maintaining the relative order of non-zero elements in the array. You also need to implement an in-place ...

Read more

Question 78. Word Ladder LeetCode Solution Problem Statement The Word Ladder LeetCode Solution – “Word Ladder” states that you are given a string beginWord, string endWord, and a wordList. We need to find the shortest transformation sequence length (if no path exists, print 0) from beginWord to endWord following the given conditions: All the Intermediate Words should ...

Read more

Question 79. Best Meeting Point LeetCode Solution Problem Statement The Best Meeting Point LeetCode Solution says Given a binary grid grid of size m x n where each 1 determines the home of one friend, we want to return the minimal total travel distance where the total travel distance is the sum of the distances between the houses of ...

Read more

Question 80. Subarray Sum Equals K LeetCode Solution Problem Statement The Subarray Sum Equals K LeetCode Solution – “Subarray Sum Equals K” states that you are given an array of integers “nums” and an integer ‘k’, return the total number of continuous subarrays whose sum equals to ‘k’. Example: nums = [1, 2, 3], k=3 2 Explanation: There ...

Read more

Question 81. Best Time to Buy and Sell Stock LeetCode Solution Problem Statement The Best Time to Buy and Sell Stock LeetCode Solution – “Best Time to Buy and Sell Stock” states that You are given an array of prices where prices[i] is the price of a given stock on an ith day. You want to maximize your profit by choosing ...

Read more

Question 82. Maximum sum of a path in a Right Number Triangle The problem “Maximum sum of a path in a Right Number Triangle” states that you are given some integers in the form of a right number triangle. Find out the maximum sum you can achieve if you start from the top and move towards the base such that you move ...

Read more

Question 83. Friends Pairing Problem Problem Statement The “Friends Pairing Problem” states that there are N friends. And each them can remain single or be paired up with each other. But once a pair is made, those two friends can not take part in pairing. So, you need to find the total number of ways ...

Read more

Question 84. Binomial Coefficient Problem Statement Find the Binomial Coefficient for a given value of n and k. “In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. Commonly, a binomial coefficient is indexed by a pair of integers n ≥ k ≥ 0 and is written as ” – quoted from Wikipedia. Example n = 5, k ...

Read more

Question 85. Count pairs from two linked lists whose sum is equal to a given value Problem Statement Problem “Count pairs from two linked lists whose sum is equal to a given value” state that you are given two linked lists and an integer value sum. The problem statement asked to find out how many total pair has a sum equal to the given value. Example ...

Read more

Question 86. K-th Distinct Element in an Array You are given an integer array A, print k-th distinct element in an array. The given array may contain duplicates and the output should print k-th distinct element among all unique elements in an array. If k is more than a number of distinct elements, then report it. Example Input: ...

Read more

Question 87. House Robber The House Robber Problem states that, in a neighborhood in a city, there is a single row of n houses. A thief is planning to carry a heist in this neighborhood. He knows how much gold is concealed in each of the houses. However, in order to avoid triggering an ...

Read more

Question 88. Sliding Window Maximum In Sliding Window Maximum problem we have given an array nums, for each contiguous window of size k, find the maximum element in the window. Example Input nums[] = {1,3,-1,-3,5,3,6,7} k = 3 Output {3,3,5,5,6,7} Explanation Naive Approach for Sliding Window Maximum For every contiguous window of size k, traverse ...

Read more

Question 89. LRU Cache Implementation Least Recently Used (LRU) Cache is a type of method which is used to maintain the data such that the time required to use the data is the minimum possible. LRU algorithm used when the cache is full. We remove the least recently used data from the cache memory of ...

Read more

Question 90. Climbing stairs Problem Statement The problem “Climbing stairs” states that you are given a staircase with n stairs. At a time you can either climb one stair or two stairs. How many numbers of ways to reach the top of the staircase? Example 3 3 Explanation There are three ways to climb ...

Read more

Question 91. Find Pair with Given Difference Problem Statement In the given unsorted array, find the pair of elements in the given array with given difference n. Example Input arr[] = {120, 30, 70, 20, 5, 6}, difference(n) = 40 Output [30, 70] Explanation Here the difference of 30 and 70 is equal to the value of ...

Read more

Translate »