Top-5 problems which recently asked from Google, Facebook, Microsoft, Twitter and Airbnb

Problem-1: This problem was recently asked by Microsoft

You are given two linked-lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contains a single digit. Add the two numbers and return them as a linked list.

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.

Problem-2: This problem was recently asked by Microsoft

Given a string, find the length of the longest substring without repeating characters. Here is an example solution in Python language. (Any language is OK to use in an interview, though we’d recommend Python as a generalist language utilized by companies like Google, Facebook, Netflix, Dropbox, Pinterest, Uber, etc).

class Solution:
def lengthOfLongestSubstring(self, s):
# Fill this in.

print Solution().lengthOfLongestSubstring(‘abrkaabcdefghijjxxx’)
# 10

Problem-3: This problem was recently asked by Twitter

A palindrome is a sequence of characters that reads the same backward and forwards. Given a string, s, find the longest palindromic substring in s.

Input: “banana”
Output: “anana”
Input: “million”
Output: “illi”

Problem-4: This problem was recently asked by Google

Given a singly-linked list, reverse the list. This can be done iteratively or recursively. Can you get both solutions?

Input: 4 -> 3 -> 2 -> 1 -> 0 -> NULL
Output: 0 -> 1 -> 2 -> 3 -> 4 -> NULL

Problem-5: This problem was recently asked by Google

Given a list of numbers with only 3 unique numbers (1, 2, 3), sort the list in O(n) time.


Input: [3, 3, 2, 1, 3, 2, 1]
Output: [1, 1, 2, 2, 3, 3, 3]

You can submit your answer by a comment on this post, I will reply back.

Leave a Reply

Your email address will not be published. Required fields are marked *