Qualcomm Interview Questions
About Qualcomm
Qualcomm is an American multinational company that was founded in Delaware and has its headquarters in San Diego, California. It makes wireless technologyrelated semiconductors, software, and services. It has patents that are very important to the 5G, 4G, CDMA2000, TDSCDMA, and WCDMA standards for mobile communications.
They have been giving India the latest technological innovations and solutions in order to make mobile communication cheaper and more available to everyone. In India, there are offices that focus on digital media networking solutions, DSP and embedded applications, and wireless modem and multimedia software.
Qualcomm is a great place to work if you want to get more experience and move up in your career. This job is the most stable in its field, and it also has some nice perks. It's easy to find people who started their careers here and are almost ready for anything. While you're there, you get to meet a lot of interesting people and attend a lot of interesting events and seminars. At Qualcomm, you can learn a lot from the people you work with and the work you do. Qualcomm also offers its employees great benefits and fun ways to get to know each other, learn soft skills, give back to the community, and take care of their families.
In this article
1. Qualcomm Recruitment Process 2. Qualcomm Technical Interview Questions: Freshers and Experienced 3. Qualcomm Interview Preparation 4. Qualcomm Coding Interview Questions 5. Frequently Asked QuestionsQualcomm Recruitment Process
Interview Process
Qualcomm requires five interview rounds to select fresh hires as Software Engineers.
 Online Test.
 Technical Round 1.
 Technical Round 2.
 Technical Round 3.
 HR Round.
Interview Rounds
1. Online Test: Candidates are given three to four coding questions online, and the questions are of medium difficulty, mainly from arrays, strings, and matrices. To pass this round, one must be familiar with these data structures.
2. Technical Round 1: There are around 2 to 4 questions that are algorithmic in nature, ranging from arrays to trees to dynamic programming problems. You must demonstrate your algorithm and/or code in some parts of the test. Apt candidates are selected for additional rounds.
3. Technical Round 2: In technical rounds, candidates are given two to four questions about data structures such as the matrix, binary tree, BST, and Linked list. The most commonly asked DSs are the matrix, binary tree, BST, and Linked list.
4. Technical Round 3: The difficulty level is increased and more questions about trees, BST, and tries are asked in this round. It is imperative that one has a firm grasp of treebased recursion, and the standard questions based on it are certainly required.
5. Technical + HR Round: The most difficult round of this competition is generally the technologyheavy and technically demanding round, in which you will be put to the test on a variety of technical and design issues and difficult problemlike questions. Things like "Tell me about yourself, and your family" and 'How you see yourself five years from now can be expected. Learn More.
Qualcomm Technical Interview Questions: Freshers and Experienced
1. What is Stack corruption?
When stack corruption is suspected, one should look at the local variables in the called and calling functions to see if the values passed are different from the values passed by the calling function. A stack corruption has occurred when a parameter seems to have a different value than the one that was passed. When a stack corruption is detected, one should look at the local variables in the called and calling functions to see if they may have been used as a source of memory corruption.
2. Given an integer array nums, return all triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i]+nums[j]+nums[k] == 0. Note that the solution set must not contain duplicate triplets.
Example 1:
 Input: nums = [1,0,1,2,1,4]
 Output: [[1,1,2],[1,0,1]]

Explanation:Â
nums[0] + nums[1] + nums[1] = (1) + 0 + 1 = 0.
nums[1] + nums[2] + nums[4] = 0 + 1 + (1) = 0.
nums[0] + nums[3] + nums[4] = (1) + 2 + (1) = 0.
The distinct triplets are [1,0,1] and [1,1,2].
Notice that the order of the output and the order of the triplets does not matter.
Example 2:
 Input: nums = [0,1,1]
 Output: []
 Explanation: The only possible triplet does not sum up to 0.
Example 3:
 Input: nums = [0,0,0]
 Output: [[0,0,0]]
 Explanation: The only possible triplet sums up to 0.
Solution
We can modify the array to improve its order. For example, if we change i to (2, 3), we can check if the array is sorted using two indices (low and high). We must ensure that duplicate values are not permitted, so we must have one check for duplicates if i is (2, 3).
class Solution {
public List<List<Integer>> threeSum(int[] arr) {
Arrays.sort(arr);
List<List<Integer>> ls = new ArrayList<>();
for (int i = 0; i<arr.length2; i++) {
if (i == 0  (i>0 && arr[i1]!=arr[i])) { //check for duplicates to avoid copy we've used arr[i1]!=arr[i] instead of arr[i+1]!=arr[i] because we must take the duplicate value in condition i.e. in example 1 [1,1,2] is also and output so if we do arr[i+1]!=arr[i] then we'll skip to the next 1 and this output will not come
int start = i+1;
int end = arr.length1;
int sum = 0arr[i];
while (start<end) {
if (arr[start] + arr[end] == sum) {
ls.add(Arrays.asList(arr[i], arr[start], arr[end]));
while (start<end && arr[start] == arr[start+1]) start++;//avoid all the same values
while (start<end && arr[end] == arr[end1]) end;//avoid all the same values
start++;
end;
} else if (arr[start] + arr[end] < sum) {
start++;
} else end;
}
}
}
return ls;
}
}
3. Multiply, divide, and modulate two integers to obtain an integer. The fractional parts of an integer are truncated away to obtain an integer.
When a dividend is divided by the divisor, the quotient is obtained. 8.345 is divided by 8, and 2.7335 is modulated by 2.7.
Example 1:
 Input: dividend = 10, divisor = 3
 Output: 3
 Explanation: 10/3 = 3.33333.. which is truncated to 3.
Example 2:
 Input: dividend = 7, divisor = 3
 Output: 2
 Explanation: 7/3 = 2.33333.. which is truncated to 2.
Solution:
In order to subtract the divisor from the dividend, we must double the divisor, double the number of divisions, check again, and increment or decrement the count by one. We must then subtract the variable from the dividend to get the original dividend.
class solution {
public int divide(int dividend, int divisor) {
if(dividend==1<<31 && divisor==1)
return Integer.MAX_VALUE;
boolean sign=(dividend>=0 ==(divisor>=0))? true : false;
dividend=Math.abs(dividend);
divisor=Math.abs(divisor);
int result=0;
while((dividenddivisor)>=0){
int count=0;
while (dividend(divisor<<1<<count)>=0){
count++;
}
result+=1<<count;
dividend=divisor<<count;
}
return sign? result:(result);
}
}
4. What is Race conditions
A multithreaded environment is characterized by multiple threads coexisting on the same resource or executing the same code block. A race condition occurs when threads execute code in parallel and share the same resource or outcome. In the wrong hands, this situation can cause havoc, as the output will be dependent on which threads were executed in sequence.
Void bankAccount(double money)
{
shared= shared + money
}
In this case, we utilised two variables. Assume shared is a variable that is shared. Let's assume that the bankAccount function is now invoked for use. The following order will be used to execute the statements of this function;
The shared variable's previous value will be loaded into one of the CPU's registers. The money variable's value will be put into a different register. Two registers will be used to hold the values of two variables, and the outcome will be computed. Put the outcome in the variable share now. For instance, if there are two processes, P1 and P2, both processes are open to calling the function bankAccount at the same time.
5. What is Semaphore?
Semaphore was first proposed by Dijkstra in 1965, and it is a very important technique that uses a simple integer value to manage concurrent processes. A semaphore is a simple integer variable that's shared between threads. The process synchronization problem is solved by using semaphores, and process synchronization is achieved in the multiprocessing environment.
If, for instance, there are four processes (P1, P2, P3, and P4), all of which call the wait operation on S (initialized with 4). When one of the four processes runs the signal function and the value of the semaphore turns positive, another process P5 should wait before requesting the resource.
6. To compute the product of two nonnegative integers num1 and num2, string each of them.
Example 1:
 Input: num1 = "2", num2 = "3"
 Output: "6"
Example 2:
 Input: num1 = "123", num2 = "456"
 Output: "56088"
Solution
Multiply every digit pair by itself and add them. We can draw the process! From the following line, we can determine that it is performed: The sum of the indices at which `num1[i]*num2[j]` is placed is determined by `[i + j + 1], `[i + j + 1 + 1]`
public String multiply(String num1, String num2) {
int m = num1.length(), n = num2.length();
int[] pos = new int[m + n];
for(int i = m  1; i >= 0; i) {
for(int j = n  1; j >= 0; j) {
int mul = (num1.charAt(i)  '0') * (num2.charAt(j)  '0');
int p1 = i + j, p2 = i + j + 1;
int sum = mul + pos[p2];
pos[p1] += sum / 10;
pos[p2] = (sum) % 10;
}
}
StringBuilder sb = new StringBuilder();
for(int p : pos) if(!(sb.length() == 0 && p == 0)) sb.append(p);
return sb.length() == 0 ? "0" : sb.toString();
}
7. Given an integer targetSum and a binary tree representing a roottoleaf path that adds up all the values along the path, return true if and only if the tree has a roottoleaf path such that adding up all the values along the path equals targetSum.
Example 1:
 Input: root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22
 Output: true
 Explanation: The roottoleaf path with the target sum is shown.
Example 2:
 Input: root = [1,2,3], targetSum = 5
 Output: false

Explanation: There two roottoleaf paths in the tree:
(1 > 2): The sum is 3.
(1 > 3): The sum is 4.
There is no roottoleaf path with sum = 5.
Example 3:
 Input: root = [], targetSum = 0
 Output: false
 Explanation: Since the tree is empty, there are no roottoleaf paths.
Solution
The function is calculating the sum of the current node value and the target value and then checks to see if the current node value is equal to the target value at the leaf node. If the function succeeds at the leaf node, it is selfevident that the path has a value of sum equal to targetSum.
Â int sum=0;
public boolean hasPathSum(TreeNode root, int targetSum) {
if(root==null){
return false;
}
if(root.left==null && root.right==null){ //checking for leaf node
if(targetSumroot.val==0){ //subtracting value of root from the sum given in order to find total sum is same to target sum or not
return true;
}
}
else{
return hasPathSum(root.left,targetSumroot.val) hasPathSum(root.right,targetSumroot.val);
}
return false;
}
}
8. What is Memory management?
Memory can be described as a collection of data in a specific format. It is used to record instructions and process data. An array or group of words or bytes, each with its own location in the memory, is the unit of memory. A computer system's primary objective is to carry out programmes. These programmes, together with the information they require, should be present in the main memory during execution. The CPU obtains instructions from memory as specified by the program counter during the execution of the programme.
9. What is Deadlock?
A deadlock is a circumstance where a group of processes are halted because they are each hanging onto resources while waiting for other processes to obtain them.
Think of a situation where there is only one track and two trains are approaching each other on it. Once they are in front of each other, none of the trains can move. When there are several processes waiting for resources owned by other processes, a similar scenario arises in operating systems (s). For instance, in the picture below, Process 1 is holding Resource 1 while Process 2 acquires Resource 2, while Process 2 is keeping Resource 1 as they both wait for Resource 2.
10. What is IPC communications?
An independent process is not affected by the execution of other processes while a cooperating process can be affected by other executing processes. In other words, one might think that independent processes will run fast, conveniently, and modularly, but in reality, cooperative behaviour can be used to increase computational speed, convenience, and modularity. Interprocess communication (IPC), or interprocess communication, is a mechanism that enables processes to contact each other and synchronize their actions. Cooperation between these processes is accomplished through this communication.
11. To reverse only the vowels in a string s, let s be given. Only the vowels 'a', 'e', 'i', 'o', and 'u' are reversed, and they may appear in any order.\
Example:
 Input: s = "hello"
 Output: "holle"
Solution:
To reverse the entire string, just swapping the first and last characters in each pass would have done the job. For reversing only the vowels, the two pointers (i and j) are used. i points to the vowels to the left, and j to the vowels to the right, then they are swapped. O(1) auxiliary space is taken and O(n) time complexity is achieved by the inplace approach.
class Solution {
public:
bool checkForVowel(char chr){
if(chr=='a'  chr=='e'  chr=='i'  chr=='o'  chr=='u'  chr=='A'  chr=='E'  chr=='I'  chr=='O'  chr=='U' )
return true;
else
return false;
}
string reverseVowels(string s) {
int n = s.length();
int i = 0,j=n1;
while(i<j){
if(checkForVowel(s[i]) && checkForVowel(s[j])){
swap(s[i],s[j]);
i++;
j;
}
else if(checkForVowel(s[i]))
j;
else if(checkForVowel(s[j]))
i++;
else{
i++;
j;
}
}
return s;
}
};
12. Find the largest contiguous subarray (containing at least one number) of an integer array nums and return its value. An array subrange is a contiguous portion of an array.
Example 1:
 Input: nums = [2,1,3,4,1,2,1,5,4]
 Output: 6
 Explanation: [4,1,2,1] has the largest sum = 6.
Example 2:
 Input: nums = [1]
 Output: 1
Example 3:
 Input: nums = [5,4,1,7,8]
 Output: 23
Solution
To solve the problem, we need to separate it into two distinguishable parts. nums[ ] contains both positive and negative numbers. We iterate through nums[ ], and we increment nums[i] by adding nums[i] to our current variable. If the current is negative, then we discard it. If the current is positive, then we retain it. In the meantime, we must ensure that max keeps track of the maximum sum. nums[ ] only contains negative numbers. We can pick up the biggest number among them simply by choosing it.
Â class Solution
{
public int maxSubArray(int[] nums)
{
// O(n) time  O(1) space
int current = nums[0];
int max = nums[0];
for(int i = 1; i < nums.length; i++)
{
current = Math.max(nums[i], nums[i] + current);
max = Math.max(current, max);
}
return max;
}
}
13. A given number array nums must have unique elements in order to obtain all possible subsets (the power set). The solution set must not have duplicate subsets. Return the solution in any order.
Example 1:
 Input: nums = [1,2,3]
 Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Example 2:
 Input: nums = [0]
 Output: [[],[0]]
Solution:
A common recursive difficulty is to recognise that at every number, we can recognise that it is a subset, so we apportion it to "curr", then ask the function to do the same for the next number using "i+1" in each subsequent call. This is simply keeping "curr" growing by adding "curr" to "curr" if "curr.size()" is less than "nums.length", then removing the latest item from "curr".
class Solution {
public List<List<Integer>> subsets(int[] nums) {
List<List<Integer>> result = new ArrayList<>();
findAll(nums, 0, new ArrayList<Integer>(), result);
return result;
}
private void findAll(int[] nums, int index, List<Integer> curr, List<List<Integer>> result){
if(curr.size()<=nums.length){
result.add(new ArrayList<Integer>(curr));
}
for(int i=index;i<nums.length;i++){
curr.add(nums[i]);
findAll(nums, i+1, curr, result);
curr.remove(curr.size()1);
}
}
}
14. What is Mutex?
A mutex is an object that provides mutual exclusion between threads by using operations such as a lock and unlock. It ensures that only one thread has access to a critical section or data by using operations like a lock and unlock. A thread holding the mutex can use the critical section whilst other threads must wait for the lock to be released. A binary semaphore that synchronizes access to shared resources like memory or I/O is called a mutex. It is a locking mechanism.Â
15. What is Priority Inversion?
When it comes to scheduling concepts in Operating systems, one of the foremost factors is Task Scheduling. There are numerous scheduling alternatives such as First Come First Serve, Round Robin, Prioritybased scheduling, etc. Each scheduling approach has its own advantages and disadvantages.
You may assume that Priority Inversion is a taskbased scheduling problem because it is listed under prioritybased scheduling. It is a circumstance that occurs in prioritybased scheduling when higherpriority jobs interfere with lowerpriority jobs when possible.
When a lower priority task (L) is running and a higher priority task (H) also needs to run, a higher priority task (H) may be preempted by a lower priority task (L) in prioritybased scheduling.
Now, assume that both lower and higherpriority tasks need to share a common resource (for example, a file or device) to accomplish their respective tasks. Here, task synchronization and resource sharing are required. Several techniques for handling such scenarios may be used, for example, mutex synchronization.
A task acquires mutex before entering the critical section (CS) and releases it after exiting the critical section (CS).Â
16. What is Mem leaks?
When programmers create a memory in the heap and forget to delete it, the consequences are that the computer's performance is reduced because of the reduction in available memory, that is, the amount of memory that is accessible. In the worst case, too much of the available memory might become occupied and the application may fail, or the system might slow down radically. Memory leaks are particularly problematic for programs such as Daemons and Servers, which by definition do not terminate.
17. Create a new integer array nums of 2n items, and groups them into as many as possible pairs (a1, b1), (a2, b2), ..., (an, bn) such that the largest possible sum is achieved. Return the largest possible sum.
 Input: nums = [1, 4, 3, 2]
 Output: 4
Explanation:Â
All possible pairings (ignoring the ordering of elements) are:
1. (1, 4), (2, 3) > min(1, 4) + min(2, 3) = 1 + 2 = 3
2. (1, 3), (2, 4) > min(1, 3) + min(2, 4) = 1 + 2 = 3
3. (1, 2), (3, 4) > min(1, 2) + min(3, 4) = 1 + 3 = 4
So the maximum possible sum is 4.
Solution
It is the idea behind this approach that we must find such pairs whose min values add up to produce the greatest possible value. We are actually eliminating a greater value by adding up to get that maximum possible value and we will choose pairs of any particular kind such that their difference is the lowest. Sorting takes place and we form pairs by sorting.
class Solution {
public:
int arrayPairSum(vector<int>& nums) {
sort(nums.begin(), nums.end());
int ans=0, n=nums.size();
for(int i=0;i<n;i++)
{
if((i%2)==0)
ans+=nums[i];
}
return ans;
}
};
18. What do you understand by Data Redundancy?
A database or data storage system can be considered to be two or more places for data redundancy. Data redundancy ensures that an enterprise can continue to operate or supply services in the event of data corruption, loss, or damage.
19. Explain Normalization and DeNormalization.
Databases must be normalized in order to structure them efficiently. It involves establishing tables and establishing connections between them based on certain rules. These rules may eliminate or reduce the amount of redundancy and dependency, making it more flexible. 1NF, 2NF, 3NF, BCNF, 4NF, and 5NF are 6 distinct normal forms. Normalization should be done to avoid data loss but not at the expense of integrity.
The procedure of denormalizing a schema is to convert it into one that has redundant information. Redundancy and keeping redundant data consistent are both beneficial. An overnormalised structure is inefficient in query processing because of its overheads.
20. A length of the longest consecutive elements sequence can be obtained from an unsorted array of integers by running the algorithm O(n) time.
Example 1:
 Input: nums = [100,4,200,1,3,2]
 Output: 4
 Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.
Example 2:
 Input: nums = [0,3,7,2,5,8,4,6,0,1]
 Output: 9
A maxlength sequence can be generated by considering each element to be a part of some series and searching for the largest sequence that includes that number. Copy all the elements in the set first. Count the previous consecutive element from this element and the similar next consecutive elements from this element. A maxlength sequence from this element is "prevCount + nextCount + 1". It is the result of the calculations above. To find the maxlength sequence, you must delete all the numbers you had visited once so that you can again try to find a sequence that already belongs to an existing sequence.
class Solution {
public int longestConsecutive(int[] a) {
int len = a.length;
if(len == 0  len == 1) {
return len;
}
int result = 0;
HashSet<Integer> set = new HashSet<Integer>();
for(int i : a) {
set.add(i);
}
for(int i = 0; i < len; i++) {
int item = a[i];
if(!set.contains(item)) continue;
int prevItem = item1;
int nextItem = item+1;
int prevCount = 0;
int nextCount = 0;
set.remove(item);
while(set.contains(prevItem)) {
set.remove(prevItem);
prevCount++;
prevItem;
}
while(set.contains(nextItem)) {
set.remove(nextItem);
nextCount++;
nextItem++;
}
result = Math.max(result, (prevCount+nextCount+1));
}
return result;
}
}
21. You are given two nonempty linked lists that each represent a nonnegative integer. The digits are kept in reverse order, with each node containing only one digit. Add the two numbers together and return the total as a linked list.
Except for the number 0 itself, you may presume that the two numbers do not have any leading zeros.
Example 1:
 Input: l1 = [2,4,3], l2 = [5,6,4]
 Output: [7,0,8]
 Explanation: 342 + 465 = 807.
Example 2:
 Input: l1 = [0], l2 = [0]
 Output: [0]
Example 3:
 Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]
 Output: [8,9,9,9,0,0,0,1]
The total may be used to maintain track of the carry bit; if the sum is greater than 10, sum / 10 will return 1 as two digits, and the carry bit cannot have a sum greater than 19. To construct the list, we utilise a double pointer to store the address of ListNode* next in the ListNode structure for the list's tail. We must first dereference the tail because we are using a double pointer. So, tail will point to the memory address where the next node will be added, (*tail) will be the address of the tail node (after memory has been allocated), and &(*tail)>next will be the address of the next ListNode in the tail node.
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
int sum = 0;
ListNode dummy, **tail = &dummy.next;
while (l1  l2  sum) {
if (l1) {
sum += l1>val;
l1 = l1>next;
}
if (l2) {
sum += l2>val;
l2 = l2>next;
}
(*tail) = new ListNode(sum % 10);
tail = &(*tail)>next;
sum /= 10;
}
return dummy.next;
}
};
22. Find the length of the longest substring without repeated characters given a string s.
Example 1:

Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc", with a length of 3.
Example 2:
 Input: s = "bbbbb"
 Output: 1
 Explanation: The answer is "b", with a length of 1.
Example 3:
 Input: s = "pwwkew"
 Output: 3
 Explanation: The answer is "wke", with a length of 3.
Notice that the answer must be a substring, "pwke" is a subsequence and not a substring.
The issue in this question is determining where to choose our next substring after identifying a duplicate character. We can simply select whatever substring we wish to examine by using two pointers and a sliding window. In fact, if you realise the following point, finding the longest substring without repeated characters becomes considerably easier.
Key Observation: Once we've located a previously encountered character, we want to change the left pointer of our window to the index following the last occurrence of that character.
To show this in action, consider the following example using the input string s = "babcadba":
class Solution {
public:
int lengthOfLongestSubstring(string s) {
if (s == "")
return 0;
//Vector vec1, stores the frequency of characters appearing on the string
vector<int>vec1(128,0);
int end = 0, max = INT_MIN, len= s.size(), start= 0;
while (end < len) {
//As we go from left to the right on the string, we fill the frequency vector.
// s[end]: if the character at s[end] was a, then it would fill the vec1 at the
// index 96, it will increase the frequeny.
vec1[s[end]]++;
//When traversing when the number at any index of the vector is greater than one means
// that there is a duplicate.
// Next question: find if a string contains duplicate, can also do it this way
if (vec1[s[end]] > 1) {
//So we start traversing our start pointer till the point there was duplicate.
//Example: abcadefgh
// will do duplicate at s[3], at this point we will bring start here,
// so next time when we calculate the maximum length we will do, end of string 
//this start
while (vec1[s[end]] > 1) {
vec1[s[start]];
start++;
}
}
if (endstart > max) {
max = endstart;
}
end++;
}
return max+1;
}
};
23. Get the longest palindromic substring contained in s from a given string s.
Example 1:
 Input: s = "babad"
 Output: "bab"
 Explanation: "aba" is also a valid answer.
Example 2:
 Input: s = "cbbd"
 Output: "bb"
General concept: compare the prior best result with the present one, loop through each letter, and determine whether its siblings are equivalent. For further information, look at the code's comments.
Â var longestPalindrome = function(s) {
// simple case
if (s.length <= 1) {
return s
}
// to store the best result
let longest = ''
// for each item, unless we are at the point, when the longest can't be any better (this is why  longest.length / 2, and divided by two becase we check siblings on both sides)
for (let i = 0; i < s.length  longest.length / 2; i++) {
let soFar = s[i]
// here we handle the case when there are few same symbols in a row
while (s[i] === s[i + soFar.length]) {
soFar += s[i + soFar.length]
}
let counter = 1
// if there were few symbols in a row, we want to know the offset
let duplicateOffest = soFar.length  1
while (typeof s[i  counter] !== 'undefined' && s[i  counter] === s[i + duplicateOffest + counter]) {
soFar = s[i  counter] + soFar + s[i + duplicateOffest + counter]
counter++
}
// update the best
if (soFar.length > longest.length) {
longest = soFar
}
// if there were few symbols in a row, we don't want to check these sybmols, as we have already done that
i += duplicateOffest
}
return longest
};
24. You are provided an nlength height integer array. There are n vertical lines made using I 0) and as the two ends of the ith line (i, height[i]). Find two lines that, when joined with the xaxis, produce a container with the most water inside.
Return the most water that a container can hold. Keep in mind that you cannot tilt the container.
Example 1:
 Input: height = [1,8,6,2,5,4,8,3,7]
 Output: 49
 Explanation: The above vertical lines are represented by an array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.
Example 2:
 Input: height = [1,1]
 Output: 1
The plan is to begin by setting a variable, fIdx = 0, at the beginning of the array and another, bIdx = height, at the rear. size()  1.
By multiplying the difference between the two index variables' lower heights, min(height[fIdx], height[bIdx]), we may first compute the maximum area (bIdx  fIdx). Next, we determine whether the computed area exceeds maxArea and, if so, update maxArea.
The biggest discrepancy between the index variables bIdx and fIdx is present in the beginning. Now, the disparity grows less if we raise fIdx or lower bIdx. This indicates that increasing the height is the only method to obtain a greater area than the existing maxArea.
Therefore, we determine which of the two heights, height[fIdx] or height[bIdx], is smaller and then either raise fIdx++ or reduce bIdx depending on whether height[fIdx] or height[bIdx] is greater.
The next subsequent area is unquestionably smaller if height[fIdx] == height[bIdx], since the index difference bIdx  fIdx decrements by 1 and the height of the area either remains the same (if the modified index variable is now at an index with equal or bigger height) or is smaller.
class Solution {
public:
int maxArea(vector<int>& height) {
int fIdx = 0;
int bIdx = height.size()  1;
int maxArea = 0;
while (fIdx < bIdx){
maxArea = max(maxArea, min(height[fIdx], height[bIdx]) * (bIdxfIdx));
if (height[fIdx] <= height[bIdx]){
fIdx++;
} else{
bIdx;
}
}
return maxArea;
}
};
25. Find three integers in the integer array nums of length n such that the total is as near to goal as possible. Give back the three integers' sum. You may suppose that there is only one possible solution for each input.
Example 1:
 Input: nums = [1,2,1,4], target = 1
 Output: 2
 Explanation: The sum that is closest to the target is 2. (1 + 2 + 1 = 2).
Example 2:
 Input: nums = [0,0,0], target = 1
 Output: 0
Finding abs(sumtarget) to be as low as feasible is our major objective. In order to improve the accuracy of our searches and our ability to assess, we attempt sorting the array first. Because the left pointer or right pointer will be holding an incorrect index above that point, we now set I to range from 0 to n3. Our left pointer is set to i+1, and our right pointer is set to nums.size()1. While concurrently caching the maximum in the ans variable, we continuously check for the minimum abs(sumtarget). Allow nums to be [1, 2, 1, 4], and set the goal to 1. We begin the array's traversal. Sorting is what we do first.
int threeSumClosest(vector<int>& nums, int target) {
if(nums.size()==0)return 0;
sort(nums.begin(),nums.end());
int m=INT_MAX,ans;
for(int i=0;i<nums.size()2;i++)
{
int l=i+1,r=nums.size()1;
while(l<r)
{
int sum=nums[l]+nums[r]+nums[i];
if(m>abs(sumtarget))
{
m=abs(sumtarget);
ans=sum;
}
else if(sum<target)l++;
else r;
}
}
return ans;
}
26. Return an array of all the distinct quadruplets [nums[a], nums[b], nums[c], nums[d]] from an array nums of n integers in the following way: A, B, C, and D are distinct if 0 = a, b, c, and d. target = nums[a] + nums[b] + nums[c] + nums[d].
You can give the response in any sequence.
Example 1:
 Input: nums = [1,0,1,0,2,2], target = 0
 Output: [[2,1,1,2],[2,0,0,2],[1,0,0,1]]
Example 2:
 Input: nums = [2,2,2,2,2], target = 8
 Output: [[2,2,2,2]]
We'll sort the array first. Take the I j, left, and right pointers. two outer loops for i and j. We keep the final total value in the sum variable.
Then, if the left+right values are equal, we attempt to compute them and add all four values to the set. Because the array is sorted, if the value is less than the total, we will increase the left and decrease the right. O(n3 logn) is the time complexity.
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
set<vector<int>>ans;
sort(nums.begin(), nums.end());
int n = nums.size();
int i=0, j=0, l, r;
while(i<n){
j=i+1;
while(j<n){
int sum=targetnums[i]nums[j];
l=j+1; r=n1;
while(l<r){
int x = nums[l]+nums[r];
int y = nums[l], z= nums[r] ;
if(x>sum)
r;
else if(x<sum)
l++;
else{
ans.insert({nums[i],nums[j],nums[l],nums[r]});
while(l<r && nums[r]==z)r;
while(l<r && nums[l]==y)l++;
}
}j++;
}i++;
}
vector<vector<int>>res(ans.begin(),ans.end());
return res;
}
};
27. Return all potential subsets for an integer array with nums unique items (the power set). There cannot be any duplicate subsets in the solution set. You can return the answers in any order.
Example 1:
Input: nums = [1,2,3]
Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Example 2:
Input: nums = [0]
Output: [[],[0]]
There are two options for each element in an array if there are n elements total. Either include or exclude the member from the subgroup.
Form a recursive answer to the issue using the aforementioned concept.
class Solution {
public:
vector<vector<int>> ans;
void helper(vector<int>&nums, vector<int>&temp, int i, int n){
if(i==n){
ans.push_back(temp);
return;
}
temp.push_back(nums[i]);
helper(nums, temp, i+1, n);
temp.pop_back();
helper(nums, temp, i+1, n);
}
vector<vector<int>> subsets(vector<int>& nums) {
int n=nums.size();
vector<int>temp;
helper(nums,temp,0,n );
return ans;
}
};
28. Return the number of structurally unique binary search trees (BSTs) that have exactly n nodes and unique values ranging from 1 to n, given an integer n.
Example 1:
 Input: n = 3
 Output: 5
Example 2:
 Input: n = 1
 Output: 1
The aim is to utilise each integer I as a root node, followed by left and right branches that represent what is smaller and greater than I respectively. Their output is the total number of distinctive structures. Add up the product for each number as a result. To remember the visited number, use a map.
public class Solution {
public int numTrees(int n) {
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
map.put(0,1);
map.put(1,1);
return numTrees(n, map);
}
private int numTrees(int n, Map<Integer, Integer> map){
// check memory
if(map.containsKey(n)) return map.get(n);
// recursion
int sum = 0;
for(int i = 1;i <= n;i++)
sum += numTrees(i1, map) * numTrees(ni, map);
map.put(n, sum);
return sum;
}
}
29. What are the HTTP and the HTTPS protocol?
The HyperText Transfer Protocol (HTTP) establishes a set of guidelines and requirements for the transmission of information across the World Wide Web (WWW). It facilitates communication between web servers and browsers. Each command in this socalled "stateless protocol" is independent of the one before it. An application layer protocol based on TCP is HTTP. By default, port 80 is used.
The HyperText Transfer Protocol Secure, sometimes known as Secure HTTP It is a more sophisticated and secure variant of HTTP. SSL/TLS protocol is used to add security on top of HTTP. By encrypting the transmission, it makes transactions more safe and aids in securely identifying network servers. By default, port 443 is used.
30. Explain LAN (Local Area Network)
LANs are frequently used to link computers, laptops, and other consumer gadgets, allowing them to share resources (such printers and fax machines) and communicate. Enterprise networks are LANs that are used by businesses or organisations. There are two types of LAN networks: wired LAN and wireless LAN, which operate without the use of cables (achieved using LAN cable). These days, wireless LANs are widely used in locations where laying cable is challenging.Â
31. What is a â€˜frame relayâ€™ and in which layer does it operate?
Frame Relay is a widearea network (WAN) data transmission protocol that connects local area networks (LANs) and uses the data connection layer of digital packet switching (WANs). X.25 and Frame Relay both use part of the same fundamental technologies. It was created to transfer analogue data as voice conversations and is based on the earlier X.25 packetswitching technology. Frame Relay is a rapid packet technology, in contrast to X.25, which was created for analogue communications, hence the protocol does not make an effort to repair faults. It is frequently used to connect LANs to primary backbones, as well as in leased T1 lines, public wide area networks, and private network settings. It is not suited for audio or video, which need a continuous stream of transmissions and require a dedicated connection during the transmission period.
32. What is a MAC address?
The distinct 48bit hardware address of a LAN card is known as a MAC (Media Access Control) address, and it is typically stored in the ROM of the network adapter card. A network card's or device's MAC address is a special identification number that manufacturers provide to certain items. It is often referred to as a physical address encoded in hexadecimal numbers. Every MAC address is distinct globally and is, in principle, set for every device.
There are six pairs of numbers in each MAC address. The first three pairs aid in identifying the manufacturer, and the following three pair names with particular models. In order to connect to networks, a computer may have a variety of devices. As a result, it is typical for a computer to have a MAC address for Ethernet, a WiFi address, and a Bluetooth address.
33. How does a firewall work?
This is one of the often asked topics in networking interviews. Information packets attempting to leave or enter the computer system are detected by the firewall by "listening" for them. It is possible to block traffic depending on a number of factors, including the IP address for which it is intended, the kind of port used to deliver it, or the application from which it originated. The setting of firewalls, or choosing which connections are banned and which are not, is one of the most challenging parts of using them.
34. Reverse the nodes of the list from position left to position right, and then return the reversal list, given the head of a singly linked list and two numbers left and right, where left = right.
Example 1:
 Input: head = [1,2,3,4,5], left = 2, right = 4
 Output: [1,4,3,2,5]
Example 2:
 Input: head = [5], left = 1, right = 1
 Output: [5]
Although it is not required, the dummy node makes the scenario when m == 1 easier to understand. Without the dummy node, we would have to reverse the list from an offset, connect the node at the offset to the head of the reversed list, and then return the original head of the list when m == 1. In the absence of the dummy node, we would have to reverse the list from the beginning like the typical reversal algorithm and return the final value of prev. These two situations converge to the latter with the fake node.
To discover the node preceding the one from which we will start to reverse, we first iterate m  1 times. That node is required so that it may subsequently be linked to the start of the reverse list. Prev and head are used to designate the head and tail of the reversed list, respectively, at the conclusion of the second loop.
class Solution
{
private:
// Given a reference (pointer to pointer) to the head of a list and an int, appends a new node at the end
void append(ListNode** head, int value)
{
// First make a new node, insert data in it, and then make its 'next' as NULL, signifying that the end of the linked list has been reached.
ListNode* newNode = new ListNode(); // 1. Allocate node
ListNode* last = *head; // Used in step 5.
newNode>val = value; // 2. Put in the data.
newNode>next = NULL; // 3. This new node is going to be the last node, so make next of it as NULL.
if(*head == NULL) // 4. If the Linked List is empty, then make the new node as head
{
*head = newNode;
return;
}
while(last>next != NULL) // 5. Else traverse till the last node.
last = last>next;
last>next = newNode; // 6. Change the next of last node.
return;
}
public:
ListNode* reverseBetween(ListNode* head, int left1, int right1)
{
int left = left1  1, right = right1  1; // We subtract 1 from the given input values because of index issues.
std::vector<int> linkedList; // This will store our linked list in a vector form.
ListNode *firstTemp = head, *finalList = NULL; // Temporary variables to hold the linked list.
// We first iterate through the LinkedList using the temporary variable 'temp' and insert the data into the vector.
while(firstTemp != NULL)
{
linkedList.push_back(firstTemp>val);
firstTemp = firstTemp>next;
}
if(left >= linkedList.size()  left < 0  left > right  right >= linkedList.size()  right < 0) // We check to make sure that the left and right conditions do not pose any outofbound conditions.
// std::cout << "\nThere are errors with the left and right value.";
return finalList;
/* What we now is essentially involves
We traverse and insert the data elements from the vector into the new linked list until we reach the 'left' index.
When we reach the 'left' index, we start inserting elements into the linked list starting from 'right' index until the 'left' index.
We then insert the remaining elements after the 'right' index.
*/
int index = 0;
for(; index < left; index++)
append(&finalList, linkedList[index]);
index = right + 1;
for(; right >= left; right)
append(&finalList, linkedList[right]);
for(; index < linkedList.size(); index++)
append(&finalList, linkedList[index]);
return finalList;
}
};
Useful Resources
Qualcomm Interview Preparation
Interview Preparation Tips
 Coding: The person conducting the interview wants to see you solve a problem with code that is wellorganized and effective.
 Say what you're thinking out loud: Try saying something along the lines of "Let's try doing it this wayâ€”not sure yet if it'll work." Simply articulating what's going through your head can help you get unstuck. Spell out what might be effective. Describe what you first thought may work, as well as the reasons why it does not. This is also true for questions that are merely meant to be lighthearted small talk. In the event that you are quizzed on your knowledge of JavaScript closures, responding with "It's something to do with scope and putting something in a function" will most likely earn you 90 per cent of the possible points.
 Just admit that you don't know anything. If you're going to make a passing reference to a fact (for example, languagespecific trivia or a hairy bit of runtime analysis), avoid giving the impression that you are more knowledgeable than you actually are. Say something along the lines of "I'm not sure, but I'd suppose something because..." rather than "I don't know." The "because" could involve ruling out other possibilities by demonstrating that their implications are absurd, drawing examples from other languages or other difficulties, or any combination of these three.
 Create pictures with a pencil. Instead of wasting time attempting to think of something in your head, try thinking about it on the board instead. Build a few unique test inputs and compare their results. Draw a diagram showing how you would achieve the target result using only manual labour. The next step is to consider how your strategy could be Implemented using code. Find a solution to the problem that is much easier to solve. You're having trouble locating the fourth largest piece in the collection, but what exactly is it? Consider the process of locating the first item in terms of its size and determine whether or not you can modify that strategy.
 Try to Solve the Problem: First, you should draught a simplistic and ineffective answer, and then you should optimise it later. Use brute force. Put out whatever effort is necessary in order to obtain a response of some kind.
 Hold your breath and wait for a hint. Do not stare at your interviewer expectantly but do take a brief second to "think"; your interviewer may have already decided to give you a hint and is just waiting to avoid interrupting. If you stare at your interviewer expectantly, your interviewer may have already decided to give you a hint and is just waiting to avoid interrupting.
 Optimizations: Consider the constraints imposed by both the runtime and the available space. If you are uncertain as to whether or not your solution can be optimised, try thinking about it out loud.
Qualcomm Coding Interview Questions
Frequently Asked Questions
1. Is the Qualcomm interview difficult?
With such strong competition, it is challenging to pass the Qualcomm interview. Employees who are capable of producing great work are highly valued at Qualcomm. If you want to work for this retailing giant, you must be familiar with its fundamental computer science concepts.
2. Why you should join Qualcomm?
For its employees, Qualcomm offers a lot of advantages as well as social opportunities to connect with one another, develop soft skills, give back to the community, and take care of their families.
3. How hard is it to get a Qualcomm internship?
Yes, given Qualcomm's corporate position and the industry's high level of competition, getting an internship there is challenging. One of the most difficult roles to land is an internship in software engineering, product development, or marketing.
4. How do I join Qualcomm?
There are four primary ways through which you may submit your application for an employment opportunity at a company that is based off campus jobs:
 Careers Page
 Job Referrals
 Hiring Challenges
 Have a Discussion with a Recruiter
5. Does Qualcomm pay well?
As per Ambitionbox, the average salary of a Qualcomm engineer in India is Rs 15.7 lakhs for employees with less than 1 year of experience to 5 years. The salary at Qualcomm ranges between Rs 11.5 lakhs to Rs 24 lakhs per year.
6. How long is the Qualcomm Interview process?
There can be multiple interviews during the hiring process. The entire process of confirmation may take up to 2â€“3 weeks. Experienced professionals are hired on average 3â€“4 weeks after the interview.
7. What is the Eligibility Criteria at Qualcomm?
 At least one bachelor's degree in engineering, information systems, computer science, or a related field or a proven history of experience in the technical field is required.
 You must be able to program in C, Python, Perl, Shell scripting, and/or makefiles and toolchains.Â
 You may also possess knowledge of makefiles and toolchains.