Software development engineer ii Interview Questions
software development engineer ii interview questions shared by candidates
Top Interview Questions
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 Sort the given array and remove the duplicates if any. Initialization- longest =1; temp=1; Iterate through the array and find the difference between the two adjacent array elements. { If (diff==1) temp++; else { if(temp>longest) longest=temp temp=1 } } The value of longest variable is the longest sequence. 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; } } Show more responses One or more comments have been removed. |
Two sorted arrays. you can start from any one them, and then at common element you may or may not jump to other array. Continue in this manner till you reach the end of an array. Find the path that results the maximum sum. |
Trees, DP, Arrays |
Remove all characters of a string from another string. The algorithm should be less than O(m*n) where m & n are lengths of strings and the space used should be less than O(m+n). |
I was asked two questions. One was given an array of integers find triplets such that a^2 + b^2 = c^2. |
They gave me an open ended problem , optimizing some part of their operations. Given a map and multiple locations from where an order has to be procured , Delivery executive location and customer location, how would you find the best path. |
1. Print unique words sorted in order of length from a file. 2. Rotate an array 3. How threads work? How threads work in a single processor system? |
Given an integer, find the next biggest integer whose digits are in increasing order. Example: Input: 118 Output: 123 Input: 127 Output: 234 Input: 987 Output: 1234 Desing question: Design a parking space to park a car. |
What happens when you release a controller that has a callback block waiting to be invoked? |
What is stack? Implementation in real life? |
See Interview Questions for Similar Jobs
- Software Engineer
- Senior Software Engineer
- Software Development Engineer
- Software Development Engineer I
- Software Developer
- Senior Software Development Engineer
- Software Engineer II
- Technical Lead
- Software Engineer III
- Member of Technical Staff
- Senior Software Developer
- Manager
- Product Manager
- Java Developer
- Consultant
- Senior Consultant
- Engineering Manager
- Principal Software Engineer