All Questions
8 questions
3
votes
2
answers
570
views
Leetcode - find if BST is valid or not
Given a binary tree, determine if it is a valid binary search tree
(BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the
node's key. The ...
8
votes
6
answers
1k
views
Implement queue using two stacks
Although it's a well-known algorithm, I thought to implement it from the perspective of a coding interview. I want to know if I can improve my code somehow. So, given the time constraint, is this a ...
2
votes
4
answers
2k
views
Reverse Polish Notation Evaluation in Java
I would like to hear feedback about my code both in term of improving efficiency if possible or using other data structures. Also go ahead and let me know about code styles/patterns.
...
4
votes
1
answer
4k
views
Sort a stack in descending order
Maintain current element as the top element in the input stack. Pop all the elements on the ordered stack which are greater than the current element and push them in to the input stack and maintain a ...
11
votes
2
answers
2k
views
Stack having push, pop and return min in O(1)
I am using a class which is taking care of minimum value so far. Please let me know of any improvements or suggestions.
...
-3
votes
1
answer
217
views
Implemented Stack using array
I'm going to job interviews soon. How I can improve my coding style and write better code?
...
4
votes
4
answers
2k
views
Class that implements a queue using two stacks
I am looking for a review of my code that implements a MyQueue class which implements a queue using two stacks.
...
16
votes
6
answers
35k
views
Implementing a Stack in Java for a technical interview
This code is based off the Stack implementation in Chapter 3 of Cracking The Coding Interview. I modified the code to make it compile and give me the correct output. I'd appreciate any feedback on ...