All Questions
Tagged with java interview-questions
358 questions
0
votes
3
answers
180
views
Java exceptions that show the message when converted to String
I’m working with custom exceptions in Java for stack operations. However, I’m unsure if the exception handling is being handled properly, especially in terms of how exceptions are thrown and caught. ...
5
votes
2
answers
643
views
Thread-safe write-efficient register() method for a Load balancer
The code below was written for an interview question of designing a load balancer with only a register() method.
...
2
votes
2
answers
146
views
A thread-safe performant Money Transfer API in Java
This is a popular interview question. It is meant to be done within 30 minutes. The task is to implement a thread-safe performant Bank Account API that allows to transfer, deposit, withdraw and check ...
7
votes
2
answers
1k
views
A thread-safe performant URL Shortener in Java
This is a popular interview question. It is meant to be done within 45 minutes. The task is to implement a thread-safe performant in-memory URL Shortener.
My implementation is based on two maps that ...
4
votes
6
answers
1k
views
Reverse string with identical spaces as in original String using Java
This is interview question
Reverse string with identical spaces as in original String using Java
For example
Original String :
best in the world and is greatest and is making sure the world goes
well
...
2
votes
1
answer
60
views
Implement simplified liquibase
I attended job interview and on live codeing session was asked to implement code based on some requirements. There are quite long text description but idea that we have to accept some file system path ...
10
votes
6
answers
5k
views
Conway's Game of Life Object oriented implementation in Java
I have designed Conway's Game of Life in Java, the solution follows Object Oriented design and paradigm, please review and let me know the feedback
Class Cell
Cell ...
1
vote
1
answer
91
views
Reverse a sublist of a singly-linked master list in constant space and maximum of one pass (Java)
So I found this funky programming challenge somewhere on Quora. The idea is to take the head of a singly-linked list, and reverse a specific sublist. The requirements are:
runs in constant space,
...
3
votes
3
answers
461
views
Find smaller angle between minute and hour hands of clock
In this code the angle between the minute and hour hands of an analog clock are found and calculated and the smaller angle between them returned. This code works perfectly and I am getting back the ...
4
votes
4
answers
3k
views
Model animals using inheritance in Java, revised
Yesterday I posted my first solution to an interview problem here. I am now aware that I have many weak spots in Java and need to do extensive review before tackling any more interviews. Having said ...
1
vote
1
answer
482
views
Model animals using inheritance in Java
I was assigned the following problem:
You've gone back in time to 500BC Athens and Socrates wants you
to build him an app to help classify animals.
Build the classes ...
6
votes
1
answer
1k
views
friend locator app
I was rejected after a tech screening for the following code.
I mainly struggled to make the code 'production ready'.
I was running out of time so I did not create a class for testing.
How could I ...
3
votes
3
answers
890
views
Chess knight move simulator
I was asked to write chess simulation of pieces as a take home interview question and was given this spec.
This is what I came up with:
ChessGenerator.java
...
7
votes
4
answers
3k
views
How can I efficiently manipulate digits in a string without using RegEx in Java?
I am reading a book with different quizzes about coding interviews.
Please implement a function that increments a string based on the rules below:
It should take the string of unknown length and ...
3
votes
2
answers
96
views
Largest Sum Contiguous Subarray - Kadene's algorithm
I am looking forward to an answer to improve this code?
Thanks.
Test class
...