# 7 mil

Preguntas de entrevista para el puesto de Ingeniero Ii compartidas por los candidatos

## Principales preguntas de entrevista

Ordenar: Relevancia|Popular|Fecha
A un Software Engineer II le preguntaron...19 de junio de 2014

### How many people flew out of Chicago last year?

68 respuestas

Actually the answer is zero. Plans fly, people don't.

Roughly as many who flew into Chicago.

oops - typo - Planes fly, people don't

Mostrar más respuestas

### Determine whether the binary representation of a number if a palindrome or not, code it on a white board.

12 respuestas

This was the first question I was asked and is considered a warm up.

anon.. would this work for a number like 17 (10001)?

bool checkPalindrome(unsigned int n) { int m = n, k =0; bool ret = false; while(m!=0) { int i = 1; i = i &amp; m; k = k &gt; 1; } if((k^n)==0) { cout&lt;&lt;"Palindrome"&lt; Menos

Mostrar más respuestas

### Given an large list of unsorted numbers, find the smallest number. You can access the list only 3 numbers at a time, and keep moving forward 1 number at a time.

6 respuestas

Otherwise called the sliding window problem

You can access the list only 3 numbers at a time: It tells we can read three numbers one after other in N/3 Iterations. So Time complexity will be O(N/3) Menos

This is sliding window problem and priority queue DS can be used to solve this.

Mostrar más respuestas

### Write a code to reverse binary bit pattern for an integer without using any string or utility methods?

6 respuestas

there is rol and ror operations which can be useful to shift places and also the left most digit can move to the end during the operation. Menos

http://www.intel.com/software/products/documentation/vlin/mergedprojects/analyzer_ec/mergedprojects/reference_olh/mergedProjects/instructions/instruct32_hh/vc270.htm this might be helpful Menos

unsigned int a=123; // Given number unsigned int b=0; /// temp variable int i; for(i=0; i&gt;1; } Menos

Mostrar más respuestas

### You are given an array of numbers. You need to print the length of the maximum continuous sequence that you encounter. For example if input is [3,8,10,1,9,6,5,7,2 ], the continuous sequences are{1,2,3} and {5,6,7,8,9,10} the latter is the longest one so the answer becomes 6. O(n) solution was asked for, assuming you have a hash map which supports O(1) insertion and fetching operations

5 respuestas

Sorting makes the time complexity as O(nlogn). An O(n) solution was asked for

package array; import java.util.Hashtable; /* * You are given an array of numbers. * You need to print the length of the maximum continuous sequence that you encounter. * For example if input is [3,8,10,1,9,6,5,7,2 ], * the continuous sequences are{1,2,3} and {5,6,7,8,9,10} * the latter is the longest one so the answer becomes 6. * O(n) solution was asked for, * assuming you have a hash map which supports O(1) insertion and fetching operations * src: http://www.glassdoor.com/Interview/Microsoft-India-Interview-Questions-EI_IE1651.0,9_IL.10,15_IN115_IP6.htm */ public class FindLengthOfLongestRandomlyDistContinousSequenceOfNumber { public static void main(String[] str){ int a[] = {3,6,8,1,5,7,0,9,2,4,10,14,13,12,11}; System.out.println(findLength(a)); int b[] = {5,2,3,1,6,7,10,8}; System.out.println(findLength(b)); } private static int findLength(int[] a) { int result = 0; Hashtable h = new Hashtable(); for(int i=0; i result){ result = curr.maxValue; } if(next != null){ next = h.get( curr.max); next.maxValue = curr.maxValue; h.put(a[i]+1, next); next.min = curr.min; } if(prev != null){ prev = h.get(curr.min); prev.maxValue = curr.maxValue; h.put(a[i]-1, prev); prev.max = curr.max; } h.put(a[i], curr); } } return result; } } class Node{ int maxValue; int max; int min; public Node(int v, int m, int n){ maxValue = v; max = m; min = n; } } Menos

static int findlongconsecutivesubseq(int[] arr) { HashSet s= new HashSet(); int ans=0; //put all entries in hashset for(int i=0;i ans) ans=j-arr[i]; } } return ans; } Menos

Mostrar más respuestas

### Find k largest/smallest number in a series of numbers. What data-structures will you use? Code it on white board.

5 respuestas

For K smallest number in series you can use a max heap of size k. When you find a new number and it is smaller than root of heap, swap it with root and heapify. Menos

@Ajit: What're the initial values of the max heap? What happens to the first value that comes in? Menos

Use selection sort for 'max' ( or for 'min') If K &gt; series.length/2 then reverse the criteria- like in stead of looking for 15th highest out of 20 element array - look for (20 -15 =) 5th lowest and so on.... Menos

Mostrar más respuestas

### 1. Test Case Enumeration: Write test cases for taxi booking application for Ola or Uber. You are expected to write testcases covering different types of functional and non-functional testing areas 2. Problem Solving: Find the first occurance of a given number from the series which has the difference between the adjacent elements as 1. For Example {1, 0, -1,-2,-1,0,1,2,3} Note: Do not use Linear Search 3. Test Data Generation Write the test data for the function: int getSmallestIntegerPosition(int[] A) This method accepts as input integer array that is already sorted and rotated "n" number of items where n is less than the size of the array For Example: The test data can be {4,5,6,1} This was derived from {1, 4, 5,6} afer sorting and rotating the array for 3 times And output of the function returns the index of integer that has the smallest value Eg: {4,5,6,1}: the smallest value is 1 and its index is 3 Note: This method searches for the element and derives the position with an order of O(log(n)) 4. Debugging While using skype or google hangout application, you are not able to do a video chat, describe how you debug the problem considering different aspects of functional and non-functional testing 5. Scripting Find the nth consecutive occurence of a character in a given string. For example for the given input string of "Amazon is a great company as it haas AtoooZzz" and the output should be "o" 6. Consider a string "Hello Good Morning" it should print the sentence in reverse order output should be "Morning Good Hello" 7. Check two strings are anagram 8. Merge two dimesional Array Consider array1 ={{10, 15}, {30, 50}} array2 ={{20,40}, {5, 10}} Merged array should be sandwitched (array 1 should be sandwitched with array 2) also while merging array if value range is less than the previously added value then that value should not be added to the merged array Output should be {10, 20, 30, 40, 50} --> 15, 5 and 10 should not be added 9. Print middle character of a string. If middle value has even then print 2 characters Eg: Amazon -->print az 10. Search an element in array without using linear search technique 11. Write test cases for Amazon Prime functionality 12. Testcases enumeration and data preperation for Whatsapp messenger

6 respuestas

OLA Test Cases - Test the installation and Unistallation of the App - Test the login and log out of the account - Test the emergency contact receives the SMS when a ride is started - Test the signup for new user - Test the ride using ola money - Test the ola money transfer after KYC has been done - Test the ola money transfer without doing KYC - Test the current location picked when opened the app - Test the favorite marking of the locations - Test the picking of desired location - Test the vehicle availability in mins for all the types - Test the vehicle availability says no when there's no active driver for that type - Test the vehicle option from source to destination - Test the source and destination are interstate - Test the source and destination are intercountry through land - Test the source and destination has no roadways - Test the source and destination between two planets - Test the driver allocated for the ride can be called from the deep link of the app - Test the money displayed before the ride and after ride are same when taken the given route - Test the money displayed before the ride and after ride changes when taken the short/long route - Test the choice of source and destination by giving lat and longs for that location - Test the driver arrived indication is notified once he marked reached. - Test the booking during rush hours when the demand is more - Test the 'sorry cab didn't found' message when the search completes without booking a cab - Test the OTP generation - Test the SMS delivered for the booked cab or auto - Test the OTP starts the ride. Only correct number - Test by giving a random OTP number to start the ride - Test the OTP number by giving vehicle number - Test the auto deduction of ola money when the ride completes - Test the cancellation of OLA cab/auto - Test the cancellation charge applied after crossing the cancellation limit for that month - Test the promo code works for each ride - Test the OLA pass is applied if the pass hasn't been expired - Test the fare changes for each variant like Prime, Mini, Micro - Test Ola outstation verification - Test the late night charges are higher than the usual - Test the cab driver cancellation of the current booking notified in the SMS and Ola app - Test the booking when the network has a weak signal strength Menos

Google Hangout - Unable to do video chat - Check whether the camera is turned on - Check whether the connected device have camera option - Check whether the internet connection is switched off - Check the video chat after refreshing or restarting the app - Check whether the Gmail account had been logged out - Check whether the camera option is disabled in the device - Check whether the camera is not working in the device - Check by opening the hangout in the mobile or other device - Check by opening the hangout in different browser window - Check by opening the hangout in different browser - Check whether the javascript is disabled - Check after clearing the cache of the browser - Check after clearing the cookie of the browser Menos

def maxRepeating(str): str = str.replace(" ", "") print(str) n = len(str) count = 0 res = str[0] cur_count = 1 # Traverse string except # last character for i in range(0, n-1): # If current character # matches with next if ( str[i] == str[i + 1]): cur_count += 1 # If doesn't match, update result # (if required) and reset count else: if cur_count &gt; count: count = cur_count res = str[i] cur_count = 1 return res str = "Amazon is a great company as it haas AtoooZzz" print(maxRepeating(str)) Menos

Mostrar más respuestas

### You have two linked lists that merge at some node. The lists could be billions of nodes long. Find the node where the lists merge in the most optimal time while using a low amount of memory.

5 respuestas

Above answer is not correct. Its a list so you can only start from the begininning. If its a doubly linked list, yes, you can start at the end (and should), but you cannot start "mid-list". Menos

I can think of two ways: 1) traverse from both heads, get two length: long, short traverse again starting from Array1[long-short] and Array2[0], looking for the same pointer O(4n) time, O(1) space 2) use a hash table holds all seen pointers. traverse from both heads O(2n) time, O(n) space Menos

Step 1: if the linked lists are not empty, find the length of each linked list. Since they have a common end point, we will get length of common area of the linked lists too. Step 2: find the difference between the length of both list. Start traverse the biggest list till the difference in length between them, provided one of them is bigger than the other. Step 3: now they are at the same remaining length. Traverse both of the together till both are pointing to the same next node.That node is the common node which is the merging point. If there is no such point, then they are not merged. Menos

Mostrar más respuestas

### None of the questions were unexpected, at least for any candidate applying for this job. I definitely felt I could have answered few questions better.

5 respuestas

Hello, Can you please share how much time did the recruiter take to get to you with an offer? Menos

General QA or a lot of coding related. Thanks

Mostrar más respuestas

5 respuestas