All Questions
14 questions
4
votes
2
answers
4k
views
Calculate arithmetic expression represented by a string, in Java
I saw that interview question online and gave it a try:
Implement a function that gets a string which represents an arithmethic expression: contains only numbers or the the operators: '+', '-', '*', '/...
6
votes
3
answers
3k
views
Reverse Polish Notation calculator with unit tests
I had an interview with a global company yesterday. They had given me a programming assignment. I shared my screen and I must have finished the task in 1.5 hours.
Task was programming Reverse Polish ...
5
votes
1
answer
457
views
Buy-sell order board, as a TDD interview
I recently did a technical test for a well known Bank in 'The City' and as a result got no further. They were also kind enough not to give me any feedback. The test entailed a TDD approach to a simple ...
5
votes
1
answer
201
views
Are AVL trees equal? - revision 3
The original question
Given two binary trees, return true if they are structurally
identical, and false otherwise.
Are AVL trees equal?
Are AVL trees equal? - revision 2
This revision on GitHub
...
1
vote
1
answer
198
views
Are AVL trees equal? - revision 2
Revision 1.
This revision on GitHub
In addition to the solution itself, I wrote tests for all the possible
cases.
It seems you have verified all execution paths are covered.
You are right. ...
8
votes
1
answer
819
views
Are AVL trees equal?
I was inspired by this answer and decided to implement an AVL tree with the methods equals and hashCode as if I was asked to do ...
5
votes
1
answer
231
views
Swap items of a linked list in pairs - revision 5
Here is the source of the question.
Given a singly linked list, swap the list items in pairs (reconnect
the pointers, not simply swap the values). For example:
Before: A->B->C->D
After: ...
1
vote
1
answer
119
views
Swap items of a linked list in pairs - revision 4
Here is the source of the question.
The solution on GitHub.
Revision 1.
Revision 2.
Revision 3.
@200_success' suggestions from revision 3:
The iterator's ...
3
votes
1
answer
110
views
Swap items of a linked list in pairs - revision 3
Here is the source of the question.
Revision 1.
Revision 2.
When I started the second round of code review, I wanted to make sure that I had included all the possible input types. However, I ...
3
votes
1
answer
201
views
Swap items of a linked list in pairs - revision 2
The first revision is available here and the code is available on GitHub. I modified the method reversePairs and added mSize to ...
2
votes
1
answer
1k
views
Find pairs in an integer array whose sum == 10
I'm practicing for technical interviews and I'm looking for ways to improve my answers/code. Please point out the flaws you see and how I can make this better.
Task:
Find pairs in an integer array ...
11
votes
2
answers
35k
views
Bowling game scorer
I was given a simple coding exercise as part of a job interview process, for which I received a negative review.
This is the question:
DiUS is starting a bowling club. To help with the club, we ...
7
votes
2
answers
5k
views
Simple calculator for an interview
Question: Simple Calculator
Input loaded from file. Instructions can be any binary operators.
Ignore math precedence. Last input is apply and a number e.g. "apply
5". Calc is then initialized ...
6
votes
2
answers
5k
views
Ways to improve my coding test FizzBuzz solution for a TDD role?
I had an interview recently where I was asked to produce the traditional FizzBuzz solution:
Output a list of numbers from 1 to 100.
For all multiples of 3 and 5, the number is replaced with "...