Tagged Questions
0
votes
2answers
88 views
remove all nodes with same value in a linked list
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return ...
1
vote
2answers
6k views
Deleting a node from Binary Search Tree
I have read about it at few places and tried to write my own version, would like to get it reviewed.
class Node {
private int value;
private Node left;
private Node right
// ...
1
vote
1answer
75 views
Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.
For example,
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, the ...
5
votes
1answer
270 views
How can I improve my algorithm?
This is a problem from Interview Street in Dynamic Programming section.
https://www.interviewstreet.com/challenges/dashboard/#problem/4f2c2e3780aeb
Billboards(20 points)
ADZEN is a very ...
2
votes
5answers
708 views
Bounded blocking queue
Can someone please review this code for me. I have not implemented all the methods for simplicity.
Original code:
/**
* Implements a blocking bounded queue from a given non-blocking unbounded queue ...
9
votes
3answers
276 views
Reversing a linked list
I implemented reversing a linked list in iterative way, just by knowing we need 3 pointers and I have never seen a code before, when I coded. I ran this code and tested it, it works fine. Even for ...
3
votes
3answers
702 views
critique my implementation of hash map
I was asked to implement a hash map in this phone interview (screen-share), so time was limited and this is what I came up with. I'd appreciate if someone can take a minute to critique/review it and ...
3
votes
3answers
396 views
Possible combinations of bills that sum to the given amount
Question:
You are given an array that represents bills in certain currency
(for example 1, 2, 5, 10) and an amount, for example 17. You should output
the number of possible combinations of ...
3
votes
2answers
506 views
flattening a doubly linked list [CPP, code review/suggestions]
I am a java dev and trying to prepare for interviews in CPP. Can someone please review the below solution for me :
Assume that you are given the head and tail pointers of a doubly linked list where ...