Software development engineer i Interview Questions in India | Glassdoor.co.in

# Software development engineer i Interview Questions in India

250

software development engineer i interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

### Software Development Engineer I at Flipkart was asked...

20 May 2016
 Design a Data Structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return minimum element from the SpecialStack. All these operations of SpecialStack must be O(1). To implement SpecialStack, you should only use standard Stack data structure and no other data structure like arrays, list, etc.4 AnswersUse two stacks: one to store actual stack elements and other as an auxiliary stack to store minimum values. The idea is to do push() and pop() operations in such a way that the top of auxiliary stack is always the minimum.how it can be in O(1) all these operationsYou have to maintain 2 stack. One is where first latest element is being added second is where the top element is the minimum one. While adding the element itself you can sort the stack to find perticular position with the help of a temporary stack(third stack) Below is the code for how can you add element public void push(int n) { mainStack.push(n); if(sortedStack.isEmpty()) { sortedStack.push(n); } else { int topnumber = -1; if(n= sortedStack.peek() && !sortedStack.isEmpty()) { topnumber = sortedStack.pop(); temp.push(topnumber); } sortedStack.push(n); while(!temp.isEmpty()) { topnumber = temp.pop(); sortedStack.push(topnumber); } } } } How to get minimum with O(1) public int getMin() { int n = -1; if(!sortedStack.isEmpty()) { n = sortedStack.pop(); } return n; } This will always return with complexity as O(1)Show more responsesIn that case complexity for push and pop will be o(n) as we are finding and replacing the correct position in the stack containing minimum values, push and pop should also be constant according to question

### Software Development Engineer I at Microsoft was asked...

17 Aug 2012
 You've a singly linked list where every node in the list has a field "random" which points to other node in the same list. Write a function to clone this list (create a new copy of the same). Don't use extra space (just the pointer variables are fine).3 AnswersIf any problem has the condition, "Don't use extra space", it in-directly means that, you can modify the list. Clarify it. It took some time for me to clarify that I'm allowed to modify the source list.didnt get the point can you please elaborate ???There is a singly linked list: A -> B -> C -> D -> E Each node has another variable called "random". It points to another node in the same list. For example, the "random" variable in the node "B", points to some other node in this list. Say, "E". Now the question is to clone this list. Got it?!

### Software Development Engineer I at Amazon was asked...

24 Mar 2012
 Find the longest palindrome in a string3 AnswersCheck out the nice C code.. http://justprogrammng.blogspot.com/2012/05/find-longest-palindrome-in-string-onn-c.html/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package towerofhanoi; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; /** * * @author sanal */ public class PalindromeEx { public boolean isPalindrome(String str){ char[] chars = str.toCharArray(); int left = 0; int right = chars.length-1; int mid = chars.length/2; for(left=0;left One or more comments have been removed. Please see our Community Guidelines or Terms of Service for more information.

### Software Development Engineer I at Amazon was asked...

28 May 2015
 Questions related to stacks, queues (Eg:Implement a queue using stacks) Trees were heavily asked as well (Print a tree spirally, check if one BT is a mirror of another BT)2 Answersimplemented queue using two stacks. For trees, recursionYou are experienced??what is the answer for content scraping solution...thanks

### Software Development Engineer I at Flipkart was asked...

25 Apr 2017
 Coin weight puzzle. find out which coin bag is heavy.1 Answertake 1, 2, 3 and so number of coins from coin bag and weigh them. now u can find out which bag is heavy by looking at weight

### Software Development Engineer I at Trelleborg was asked...

22 Jan 2016
 1) Difference in Angular JS 1 and Angular JS 2 2) Impact of Angular JS 2 for Ionic framework. 3) Which version of Angular JS are you using? 4) Which version of Bootstrap are you using? 5) What is the difference between Phongap and Cordova? 6) Given: var a = [1,2, 3]; Ho do you implement : a.sum() returns summation of the values in that array.1 AnswerI answered them in Angular JS perspective whereas the questions where asked from jQuery perspective.

### Software Development Engineer I at Microsoft was asked...

17 Aug 2012
 You're converting a string (s1) into another (s2) by changing the characters in s1. You can do add/delete/replace the characters of s1 to get s2. The cost of any of those operation for a character is 1. Find the minimum cost to convert s1 into s2. Write program and test cases for the same. For example: Convert "Hi" into "Hey". This would require minimum two cost. 1. Replace 'i' with 'e' in s1 2. Add 'y' to s1. Now we've s2.1 AnswerIts a classic dynamic programming problem. Search for Levenshtein Distance in wikipedia.

3 Oct 2014