Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [interview-questions]

This tag is for questions that came up in an interview.

Filter by
Sorted by
Tagged with
8
votes
1answer
168 views

FizzBuzz in Csharp

For my first CodeReview, I would like to present my FizzBuzz solution in C#. My design has all of the rule logic about when to display what in separate classes through an interface. This design should ...
8
votes
1answer
222 views

Recursive parser from Binary to JSON output

Background I got this interview test and got declined due to not meeting their expectations, but never got a reason on what was bad and how they solved it. I want to improve and learn something out ...
8
votes
2answers
2k views

Hackerrank - value of friendship (II)

Problem statement You're researching friendships between groups \$n\$ of new college students where each student is distinctly numbered from \$1\$ to \$n\$. At the beginning of the semester, no ...
8
votes
1answer
666 views

Analysing the results of various search engines and determining a winner

This is a programming challenge I submitted as part of a job interview, which I failed because it lacked "maintainability" and "patterns and best industry practices", so I guess we could all learn ...
8
votes
1answer
5k views

Highest pit - only climbing through the pit once

Problem description: A non-empty zero-indexed array A consisting of N integers is given. A pit in this array is any triplet of integers (P, Q, R) such that: 0 ≤ P < Q < R < N; ...
8
votes
3answers
5k 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 ...
8
votes
2answers
784 views

Sequential execution

I made a class that I think satisfies the conditions: Actions can be added to the queue at any time by any number of clients. ...
8
votes
1answer
202 views

Summarize a document as a key-phrase or key-words

A few days ago I finished a coding challenge for a potential job. I was super happy with my code, till I got the response that my code wasn't good enough. :( So, apparently I'm still making mistakes, ...
8
votes
1answer
136 views

Determine when a task will be completed

A friend of mine told me he had the following exercises at his interview : You need to determine when a task will be completed if you are given : A date when the task is started The ...
8
votes
1answer
897 views

Billboard challenge algorithm

This is a problem from Interview Street in Dynamic Programming section. Billboards (20 points) ADZEN is a very popular advertising firm in your city. In every road you can see their ...
7
votes
4answers
2k views

Implement an algorithm to determine if a string has all unique characters

I'm working through Cracking the Coding Interview. The first challenge is to implement an algorithm to determine if a string has all unique characters. I've gone through several iterations, but here'...
7
votes
3answers
12k views

strstr implementation

Please review my strstr implementation. This is an interview question that does not allow the use of strlen(). Is there a better way than using a boolean below? <...
7
votes
6answers
1k views

Find max number you can create from an array of numbers

Was asked this in an interview yesterday: You are given an array of numbers (not digits, but numbers: e.g. 9, 23, 184, 102, etc.) - you need to construct the largest number from it. For example: you ...
7
votes
2answers
1k views

Validate IP4 address

Validate IP Address I got this problem during an interview. And would like to get some code review. I also wrote several tests with the expected output, and they all passed as expected. Validate ...
7
votes
4answers
611 views

Calculating linux based octal file permission

I'm applying for a mid level devloper position. In order to progress to 2nd interview, you need to pass a technical test. One of the questions was to write a function to work out linux based octal ...
7
votes
3answers
12k views

One character diff - string comparison

The question was: Create an algorithm to check if two strings differ by one character. This wasn't my interview, so I tried to understand the question. Options: just compare the chars one by one,...
7
votes
4answers
2k views

First missing positive

As usual, please be brutally honest with your opinion of my code, and how you would judge it if I were to code this at a top-tier tech company for an interview(think Google, MSFT, Facebook, etc). My ...
7
votes
3answers
10k views

Find elements occurring even number of times in an integer array

I came across an interview question, which is like this: You have an array of integers, such that each integer is present an odd number of time, except 3 of them. Find the three numbers. I tried ...
7
votes
1answer
1k views

What's wrong with this FizzBuzz?

The rules are unsurprisingly: Write a program that prints the numbers from 0 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For ...
7
votes
2answers
985 views

Reversing a domain name string in Java

Given a dot separated domain name, reverse the domain elements. Example: ...
7
votes
3answers
2k views

Simplifying a path

Please be super brutal, and treat this as a top technical interview. Worst case analysis: \$O(n)\$ (please confirm) Space complexity: \$O(n)\$ Problem: Given an absolute path for a file (...
7
votes
2answers
6k views

Spring password validator library

I recently got rejected at a job interview for submitting this: https://bitbucket.org/gnerr/password-validator The interviewer asked for a password validation library that was configurable via ...
7
votes
4answers
1k views

Given an unordered list of numbers, find all pairs that add up to x

I am coding an interview question from Yahoo Software Engineer Intern Interview. Given an unordered list of numbers, find all pairs that add up to x. I have a working solution in Java: ...
7
votes
2answers
3k views

Implement Java hasNext() and next() in C++

Recently came upon this question asked in interview with major tech company. Implement Java's next and hasNext function in your favorite programming language. Here is the solution I came up with....
7
votes
3answers
416 views

Rock Paper Scissors coding challenge

I did a job application to a Unity developer position and i was given a coding challenge which was implementing a Rock Paper Scissors game or a variation of it. I have implemented the game using Unity ...
7
votes
2answers
558 views

Iterator for BFS binary tree traversal

I implemented an iterator pattern for C# using IEnumerator and IEnumerable. The goal of the implementation is to traverse a ...
7
votes
3answers
20k views

Printing out a binary tree level by level

Below is my implementation for an interview question of printing a binary tree level by level. I've also included some methods for creating a binary tree from a vector in my solution. Please review ...
7
votes
2answers
4k 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 ...
7
votes
3answers
7k views

Find K biggest numbers in the array

I was trying to implement method number 2, from this article. Method 2 (Use temporary array) K largest elements from arr[0..n-1] Store the first k elements in a temporary array temp[0..k-1]....
7
votes
3answers
3k views

Implementing a queue in Java for a technical interview

This code is based off the Queue implementation in Chapter 3 of Cracking The Coding Interview. I modified the code to make it compile and give me the correct output....
7
votes
5answers
202 views

String combinations of 0 and 1

I was asked this question in an interview: Given a string s consisting of 0, 1 and ...
7
votes
2answers
5k views

Simple checkboxes with React

I was given the following exercise as part of a job interview process. I submitted my code and received the feedback that my solution is "close" but not "correct". My code executes just fine and ...
7
votes
3answers
17k views

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 ...
7
votes
4answers
7k views

Bank accounts with methods to transfer funds

I recently took a programming exam for an interview and unfortunately didn't pass it. I wasn't offered any feedback about the results. I'm looking for help on how to improve my OOP skills. The ...
7
votes
3answers
2k views

Elevator Interview Problem OOP - Revised

Elevator program code challenge, revised: Can someone please critique my Elevator problem - I wanted to use OOP principles and coding standards. Also, does logic make sense? ...
7
votes
2answers
782 views

Create a dynamic growing pyramid

In connection with a job application I have to progress the following task: Create a dynamic growing pyramid. The structure has to be sorted alphabetically (concerning the inserted values). ...
7
votes
2answers
2k views

C++ 2D shape intersections - template reduction

I've created a short piece of code to determine whether or not various 2D shapes (circles/lines/rectangles) intersect. It was a job interview question, but now it's just about self-improvement. I'd ...
7
votes
3answers
518 views

Inventory coding interview exercicse

This past week, I had a coding interview where I have failed badly. The feedback that I get from the recruiter was that my code reminded the team of older ways of coding in C#. This led them to ...
7
votes
1answer
149 views

Build a set of REST interfaces using Symfony framework

I have got a technical challenge from a company but they reject my code and I'm not sure how to do this challenge in a more efficient way so I'm here to get some guidance. The Technical challenge was:...
7
votes
1answer
209 views

Drone Delivery Scheduling Service

I recently did a interview with WalmartLabs. I was tasked with a take home assignment. I didn't sign a NDA and a team at WalmartLabs said I could post the code on GitHub. I was tasked with developing ...
7
votes
2answers
431 views

OHLC chart implementation

I recently failed a Java interview exercise, and I'd like to know where I went wrong. As far as I can tell the code works, the tests pass, and the interviewer didn't give any specific feedback. The ...
7
votes
2answers
2k views

OOP Blackjack in Python

I worked on this for a software engineer interview as the take home challenge. The company came back with this constructive feedback: You made a slight mistake in ace handling that led to the ...
7
votes
2answers
184 views

Load and analyze a list of people from a file

I recently completed a programming task in Java for a job that was javascript heavy but the hiring company wanted some Java knowledge. I've been using Java since the turn of the year. Other than ...
7
votes
2answers
1k views

Calculate the score of a bowling game

Before a job interview, I was asked to create a program that can calculate the score of a bowling game. The full assignment and my code can be viewed on my Github. The company told me that this was ...
7
votes
3answers
2k views

Object-oriented Bank class

I am quite new to programming and was given an assignment in a job recruitment(now finished) to program a simple Bank class and other relevant classes based on this interface: ...
7
votes
2answers
586 views

A roman to integer converter

For an interview question I made a roman to integer converter: ...
7
votes
1answer
11k views

Caches implementation in C++

I had a test task for internship where the main part was in implementing fixed size caches with different displacement policies (LRU/LFU/FIFO). I did that task, but was refused afterwards. Now I am ...
7
votes
2answers
745 views

Finding pairs of numbers within A that add up to N

I am working on an interview question from Amazon Software Interview: Given an integer N and an array of unsorted integers A find all pairs of numbers within A which add up to N I have a working ...
7
votes
2answers
3k views

Finding alternating sequence in a list of numbers

Please be brutal and treat this as me coding this up for an interview. A sequence of numbers is called a zig-zag sequence if the differences between successive numbers strictly alternate between ...
7
votes
2answers
3k views

Pascal's triangle for an interview in PHP

I saw that one of the interview questions could be building a pascal triangle. Is there anything wrong with this particular solution I came up with? ...