As of my last update in September 2021, Google is known for conducting rigorous and challenging interviews when hiring new employees. Their interview process aims to assess a candidate's technical skills, problem-solving abilities, coding proficiency, and cultural fit within the company. The proces...
Top Google Questions – Part 1
Top Google Questions
1. Two Sum
3. Longest Substring Without Repeating Characters
4. Median of Two Sorted Arrays
5. Longest Palindromic Substring
6. ZigZag Conversion
8. String to Integer (atoi)
11. Container With Most Water
14. Longest Common Prefix
19. Remove Nth Node From End of List
23. Merge k Sorted Lists
24. Swap Nodes in Pairs
26. Remove Duplicates from Sorted Array
27. Remove Element
33. Search in Rotated Sorted Array
34. Find First and Last Position of Element in Sorted Array
35. Search Insert Position
38. Count and Say
41. First Missing Positive
46. Permutations
50. Pow(x, n)
51. N-Queens
53. Maximum Subarray
54. Spiral Matrix
55. Jump Game
59. Spiral Matrix II
60. Permutation Sequence
66. Plus One
67. Add Binary
69. Sqrt(x)
70. Climbing Stairs
72. Edit Distance
74. Search a 2D Matrix
75. Sort Colors
77. Combinations
,78. Subsets
79. Word Search
80. Remove Duplicates from Sorted Array II
81. Search in Rotated Sorted Array II
83. Remove Duplicates from Sorted List
84. Largest Rectangle in Histogram
88. Merge Sorted Array
94. Binary Tree Inorder Traversal
96. Unique Binary Search Trees
101. Symmetric Tree
102. Binary Tree Level Order Traversal
103. Binary Tree Zigzag Level Order Traversal
105. Construct Binary Tree from Preorder and Inorder Traversal
109. Convert Sorted List to Binary Search Tree
110. Balanced Binary Tree
114. Flatten Binary Tree to Linked List
118. Pascal's Triangle
119. Pascal's Triangle II
121. Best Time to Buy and Sell Stock
129. Sum Root to Leaf Numbers
130. Surrounded Regions
136. Single Number
137. Single Number II
144. Binary Tree Preorder Traversal
145. Binary Tree Postorder Traversal
146. LRU Cache
153. Find Minimum in Rotated Sorted Array
162. Find Peak Element
163. Missing Ranges
169. Majority Element
173. Binary Search Tree Iterator
174. Dungeon Game
198. House Robber
200. Number of Islands
205. Isomorphic Strings
207. Course Schedule
208. Implement Trie (Prefix Tree)
219. Contains Duplicate II
221. Maximal Square
222. Count Complete Tree Nodes
226. Invert Binary Tree
230. Kth Smallest Element in a BST
231. Power of Two
237. Delete Node in a Linked List
242. Valid Anagram
246. Strobogrammatic Number
, 1. Two Sum
Description
Given an array of integers, return indices of the two numbers such that they add
up to a specific target.
You may assume that each input would have exactly one solution, and you may not
use the same element twice.
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> m;
for (int i = 0; i < nums.size(); ++i) {
if (m.find(target - nums[i]) == m.end()) {
m[nums[i]] = i;
} else {
return {m[target - nums[i]], i};
}
}
return {-1, -1};
}
};
3. Longest Substring Without Repeating Characters
Description
Given a string, find the length of the longest substring without repeating
characters.
Example 1:
Input: "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.
Example 2:
Input: "bbbbb"
Output: 1
Explanation: The answer is "b", with the length of 1.
Example 3:
Input: "pwwkew"
Output: 3
Explanation: The answer is "wke", with the length of 3.
Note that the answer must be a substring, "pwke" is a subsequence
and not a substring.
Solution
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller tusharrawat1. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for £9.49. You're not tied to anything after your purchase.