Stacks Interview Questions
- 0of 0 votes
AnswersPigeon: Peace:: White flag : ?
- hr@zynofus.com November 29, 2021 in India
A) Surrender B) War
C) Victory D) friendship| Report Duplicate | Flag | PURGE
zynofus Technologies private limited HR Stacks - 0of 0 votes
Answershttps://codejamanalysis.wordpress.com/2017/03/18/crossover-problem-super-stack/
- akshaysjk June 13, 2018 in United States
Any Optimized Solution to avoid TLE for 4 test cases. I have tried by implementing Stack using Doubly Linked List.
Still not able to pass test cases!!!| Report Duplicate | Flag | PURGE
Java Developer Data Structures Java Stacks - 1of 1 vote
AnswersGiven an extremely large file that contains parenthesis, how would you say that the parenthesis are balanced?
The file cannot fit in the memory. How would you process the file and how would you store the intermediate results.
Walk me through the entire algorithm.
- CodeNinja December 14, 2017 in United StatesExamples: {[()]}, {[](){}}, [] are some valid examples.
| Report Duplicate | Flag | PURGE
Google Software Engineer Stacks - 0of 0 votes
AnswerImplement stack using a queue.
- purva7 July 24, 2017 in United States| Report Duplicate | Flag | PURGE
GE (General Electric) Software Developer Stacks - 0of 0 votes
AnswersYou are given two Queues where each queue contains timestamp price pair. You have to print <price1 price 2> pair for all those timestamps where abs(ts1-ts2) <= 1 second where ts1 and price1 are the from the first queue and ts2 and price2 are from the second queue.
- sonesh May 08, 2017 in United States
Now let's say one queue is slow, what kind of modification you will make?| Report Duplicate | Flag | PURGE
Two Sigma Software Engineer / Developer Stacks q - 0of 0 votes
AnswersQ 4. You are given a binary tree, and you have to return list of lists of node. where same level nodes should be in the same list, nodes are in opositive order in next list from the previous list
Ex:4 / \ 3 5 / \ \ 1 10 -4
Output would be
- sonesh April 28, 2017 in United States
[[4], [5, 3], [1, 10, -4]]
Desigred Complexity : O(N) + O(N).| Report Duplicate | Flag | PURGE
Hitachi Data Systems Software Engineer / Developer Linked Lists Stacks Trees and Graphs - 0of 0 votes
AnswersSort a stack using only one other stack and no recursion.
- mh4wt@virginia.edu December 18, 2016 in United States| Report Duplicate | Flag | PURGE
Microsoft Intern Stacks - 0of 0 votes
AnswersIn my First round, very first question that guy asked me is to generate an algorithm to check whether string is palindrome or not. After that in the same round, he asked me to create a class that duplicates the Stack property.
First, String Palindrome:
Used stringbuilder, i.e.StringBuilder sb = new StringBuilder(str); System.out.println(sb.reverse());
then he told me to not to use StringBuilder, so i convert string into the char array, then apply loop till half the size of the string. and check character by character. He said ok. "looks good".
- darpanshah08 March 24, 2015 in United States for Amazon Prime| Report Duplicate | Flag | PURGE
US Software Engineer Stacks String Manipulation - 1of 3 votes
Answersdesign and implement a calculater that can calculate expressions like:
- srcnaks February 02, 2015 in -
+ 2 4
* 8 ( + 7 12)
( + 7 ( * 8 12 ) ( * 2 (+ 9 4) 7 ) 3 )
(PS:all items are space delimetered.)
Example answers
+ 2 4 => 2 + 4 = 6
* 8 ( + 7 12) => 8 * ( 7 + 12 ) = 152
( + 7 ( * 8 12 ) ( * 2 (+ 9 4) 7 ) 3 ) => 7+8*12+2*(9+4)*7+3 = 148| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm Data Structures Problem Solving Stacks String Manipulation Trees and Graphs - 0of 0 votes
Answersfind if linked list is palindrome
- helphand2015 January 22, 2015 in India
a -> b-> Null| Report Duplicate | Flag | PURGE
McAfee SDET Stacks - 4of 6 votes
AnswersWrite a program to implement Double Linked List from Stack with min. complexity.
- Purushotham Kumar October 20, 2014 in United States| Report Duplicate | Flag | PURGE
Google Software Engineer Intern Data Structures Java Linked Lists Stacks - 0of 0 votes
AnswersDesign a stack using queue(s)
- LCHammer September 25, 2014 in United States for Advertising| Report Duplicate | Flag | PURGE
Amazon SDE1 Stacks - 0of 2 votes
AnswersDesign a system like friend's functionality in facebook. should have all features of facebook's friends functionality. like for each person , he can have any number of friends , he will get suggestions for new firends , showing common friends if we visits any other profile . algo should be scalable , robust .
- gopi.komanduri August 02, 2014 in United States| Report Duplicate | Flag | PURGE
Computer Scientist Algorithm Android Application / UI Design Arrays Bit Manipulation C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Database Distributed Computing Dynamic Programming Hash Table Java Large Scale Computing Linked Lists Math & Computation Object Oriented Design Problem Solving Sorting SQL Stacks System Design Trees and Graphs XML - 1of 1 vote
AnswersGiven a mathematical expression, remove the redundant brackets from the expression.
- !@# May 08, 2014 in Indiae.g. input: (a + (b*c)) * (d * ( f * j) ) output should be: (a + b * c) *d * f * J
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Stacks - 4of 4 votes
Answersgive an algorithm for finding duplicate parenthesis in a expression.
example :
- rahul May 02, 2014 in United States(( a + b ) + (( c + d )))
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Stacks - 1of 1 vote
Answersgive an algorithm for finding duplicate parenthesis in a expression.
- rahul May 02, 2014 in United States
{{ (( a + b ) * (( c + d ))) }}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Stacks - 1of 3 votes
AnswersOne of the questions in one of the interviews -
- pretentious.bastard March 03, 2014 in United States for SQL BI
Given a stack S and another empty stack T and a variable v, write a function that returns S but with its elements reversed.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Stacks - 3of 3 votes
AnswersImplement a stack with O(1) push, pop, and min
- msito October 14, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Stacks - -5of 7 votes
Answersneed to implement a weather report functionality. user will provide the city name , need to return the weather report.
- gopi.komanduri May 29, 2013 in India
if weather station exists n functioning properly , will return the weather report of that station .
else ,
will return the nearest available weather station report.
interviewer looking for optimized manner.
looking for datastructures to stores the cities n algo to return the report.| Report Duplicate | Flag | PURGE
Mentor Graphics Analyst Algorithm Arrays Bit Manipulation Brain Teasers C C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Dynamic Programming General Questions and Comments Graphics Hash Table Ideas Linked Lists Math & Computation Object Oriented Design Problem Solving Sets Sorting Stacks String Manipulation Terminology & Trivia Threads Trees and Graphs XML - 3of 3 votes
AnswersQ: Do you know what is a stack? Explain
- Aditya April 14, 2013 in United States
A: Yes, explained LIFO push pop peek
Q: In stack, Push and Pop are constant. What will you do if you want an operation which gives the min of the stack also in constant time?
A: Question is straight out of Gayle's Book. You just maintain a new stack of minimum number till that point.| Report Duplicate | Flag | PURGE
Bloomberg LP Financial Software Developer Stacks - -1of 1 vote
AnswersImplement Queue using stacks
- ruddermechanic February 07, 2013 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Stacks - 0of 0 votes
AnswersFind the minimum element in a stack in O(1) time complexity and O(n) space complexity
- debajyoti2510 August 04, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Stacks - 0of 0 votes
AnswersReverse a stack without using extra stack (i.e. doing in place reversal). (hinted about using double recursion).
- nihaldps February 21, 2012 in India| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Stacks - 0of 0 votes
Answersimplement a stack which will support three additional operations in addition to push and pop:
- arindam.mitra2 September 04, 2011
1.peekLowestElement()//return the lowest element in the stack without removing it from the stack
2.peekHighestElement()//return the highset element in the stack without removing it from the stack
3.peekMiddleElement()//return the (size/2 +1)th lowest element in the stack without removing it from the stack.
faster is better.Assume every method will be called with equal frequency.| Report Duplicate | Flag | PURGE
WorksApp Software Engineer / Developer Stacks - 0of 0 votes
AnswersImplement enqueue and dequeue operations using stack(s).
- Anil February 22, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Stacks Linked Lists - 0of 0 votes
Answershow to convert a queue into stack
- aaaa June 25, 2010| Report Duplicate | Flag | PURGE
IBM Software Engineer / Developer Stacks - 0of 0 votes
AnswersImplement Queue using Stack.
- AnonymousUser March 28, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Stacks - 0of 0 votes
AnswersFive boxes, A through E, are stacked in alphabetical order with box A on top. The bottom three boxes are simultaneously removed and placed on top with their vertical order maintained. If this procedure were repeated two more times which box would end up in the middle of the stack?
- Annonymous.... October 29, 2009
Box E
Box D
Box C
Box A
Box B| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Stacks