4
votes
3answers
210 views

interview question, friends, movies and likes

I was recently asked to implement an interface for a job interview. the class has methods to add customers and movies, the customers can watch or like movies and add friends. there are methods to get ...
5
votes
5answers
1k views

Finding repeating numbers in an array

I want to search through an array of n numbers and find the numbers that are repeated. So far I have this code, which does the job, but I find it to be a rather cumbersome method, but I can't seem to ...
6
votes
4answers
362 views

Critique: readability of java interview question

In Cracking the Coding Interview by Gayle Laakmann McDowell, there's a question that asks you to write code for the following: Given two sorted arrays, A and B. Write a method merging the elements of ...
4
votes
1answer
156 views

Improving a Swedish Tax Calculator

I'm submitting this code in a couple of days as part of an an interview process. The company knows that I don't have any formal experience with Java. I'm hoping they are testing my ability to learn ...
3
votes
1answer
166 views

Interview example [closed]

Recently I participated in an interview for a Russian company in Moskow and could not answer some of the simple questions. One of them I would like to ask here. List all problems which you can see in ...
5
votes
4answers
689 views

Find missing number from list

I was asked a question in an interview the other day, the question was: "You have an array list of numbers from 1 to 100, the problem is that one number is missing. How would you find that number?" ...
6
votes
3answers
256 views

Exception handling, et al - How do I make this not “poor”?

I haven't done Java coding in years, but I thought I would give it a shot for a job interview. I have a few questions: Why is this error handling considered poor? How am I supposed to be doing it? ...
5
votes
3answers
923 views

Approximate String Matching Interview Question

I was working on the challenge Save Humanity from Interviewstreet for a while then gave up, solved a few other challenges, and have come back to it again. The code below generates the correct ...
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
926 views

Implement a function to check if a tree is balanced

Yet another interview question: Implement a function to check if a tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that no two leaf nodes differ ...
3
votes
4answers
895 views

Describe how you could use a single array to implement three stacks

I'm preparing for an interview so I'm trying to solve some problems to stretch my mind. Here is one: Describe how you could use a single array to implement three stacks. And here is my ...
3
votes
5answers
1k views

FizzBuzz implementation

The common FizzBuzz implementation I saw is using a check for % 15 for printing "FizzBuzz" Would you let me know if there is anything wrong / better with this approach? public class FizzBuzz { ...
3
votes
1answer
388 views

Java: Find the smallest integer not in the list - Memory Efficiency

This is a fairly popular interview question that I conceptually understand but have never really attempted to implement. In other similar implementations of this in Java I have seen they typically ...
3
votes
3answers
395 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 ...
2
votes
3answers
855 views

Better implementation of a simplified regular expression engine?

Task: On an alphabet set [a-z], a simplified regular expression is much simpler than the normal regular expression. It has only two meta characters: '.' and '*'. '.' -- exact one arbitrary ...

1 2
15 30 50 per page