Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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: '+', '-', '*', '/...
John's user avatar
  • 213
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 ...
gungor's user avatar
  • 173
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 ...
Chris Danson's user avatar
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 ...
Maksim Dmitriev's user avatar
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. ...
Maksim Dmitriev's user avatar
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 ...
Maksim Dmitriev's user avatar
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: ...
Maksim Dmitriev's user avatar
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 ...
Maksim Dmitriev's user avatar
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 ...
Maksim Dmitriev's user avatar
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 ...
Maksim Dmitriev's user avatar
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 ...
csw's user avatar
  • 43
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 ...
user50772's user avatar
  • 111
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 ...
user31874's user avatar
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 "...
seanhodges's user avatar