Questions tagged [interview-questions]

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

Filter by
Sorted by
Tagged with
3
votes
2answers
253 views

Longest Palindromic Substring better approach

I have encountered to this question and applied a brute force algorithm off top of my head and couldn't find a better optimized solution. I was hoping I could get some insight to implement a better ...
7
votes
1answer
43 views

Find neighboring PINs on a numeric keypad

I am new to coding and to apply for an internship I need to solve several tasks. This is one of them. I wrote working code, but the program says it takes too long to complete. Help me speed up my code ...
2
votes
0answers
43 views

Modelling a Call Center in Java (multithreading approach)

I wanted to give a shot to Modelling a Call Center from Cracking the Coding Interview. The problem statement is as follows: You have a call center with three levels of employees: Respondent, ...
-1
votes
1answer
1k views

Maximum Difference in an Array [closed]

Maintain a minimum and max difference as we scan the input array. ...
5
votes
1answer
117 views

Call center escalation excercise, using Chain of Responsibility pattern

This is a coding interview I found online, to be solved within 30 minutes: Design an OOP concept for an application where employee can dispatch their incoming phone call according to their ...
5
votes
2answers
2k views

Minimum swaps algorithm terminated due to timeout

I have been trying to solve this question. Given an unordered array consisting of consecutive integers [1, 2, 3, …, n], find the minimum number of two-element swaps to sort the array. I was able ...
2
votes
3answers
112 views

Reading, cleaning and parsing CSV

This project was completed as part of an interview challenge. The feedback I received was: The code is neither optimized nor does it follow generally accepted paradigms, naming conventions or best ...
1
vote
1answer
178 views

Longest Substring Without Repeating Characters in Scala

Question is taken from Leetcode and solution works for their test cases. I do see a scope of improvement and make it more functional (getting rid of vars and mutables data structures). Please suggest ...
3
votes
1answer
51 views

Comparing algorithms to decode a String

I am writing a function to decode a string, which means performing a string transformation like 3e4f2e --> eeeffffee. I have ...
3
votes
1answer
60 views

System Dependency Manager - Ruby

I recently got a prompt when looking for a job. To spare any details, the company decided not to get back to me, so because I did not get a code-review/feedback from them, I was wondering if someone ...
5
votes
1answer
78 views

News reading application version 2

following the answer I got from t3chb0t last time News-reading application using the Observer pattern and also following the example here https://msdn.microsoft.com/en-us/library/dd990377(v=vs.110)....
2
votes
2answers
140 views

Ruby implementation for Hacker Rank connected cells in a grid

https://www.hackerrank.com/challenges/connected-cell-in-a-grid/problem problem statement: Consider a matrix where each cell contains either a 1 or a 0. Any cell containing a 1 is called a ...
1
vote
1answer
1k views

Print odd and even numbers using two threads in Java

I was asked below question in an interview where I need to print out even and odd numbers using two threads so I came up with below code one without synchronization and other with synchronization. <...
6
votes
4answers
113 views

LeetCode ZigZag helper function code

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) ...
6
votes
5answers
4k views

Simple online auction system in Java

I recently applied for a Java developer position and I was asked to completed a coding task. After review of the coding task, the company said they do not want to take me forward to interview. They ...
3
votes
1answer
65 views

Find minimal number of days to meet all your friends

I was asked this in an interview yesterday: You get an array of segments (segment contains 2 numbers, representing days count (say in a month, but could be in a year, etc.): start, end). You need to ...
13
votes
3answers
12k views

Get all combinations of selecting k elements from an n-sized array

Was asked this today in an interview. Didn't see it before, and spent quite a lot of time getting it to work (tricky with all the recursion). The goal was to find all possible combinations of ...
13
votes
1answer
975 views

Interview coding challenge for iOS Part 2 - the application in Objective-C and Swift

I recently interviewed with a company that needed a C/C++ programmer to work on the iOS side of the products. The job description indicated they needed someone with 4 years of Objective-C and iOS ...
3
votes
1answer
31 views

T-SQL Query remove duplicates except for original row from the table

Question: There is an Exam_Merge table into which to import records from a similarly structured table in another database. In this case, the Exam_Merge table contains the values of the primary key ID ...
2
votes
5answers
869 views

Award Budget Cuts implementation in Java

PRAMP Award Budget Cuts The awards committee of your alma mater (i.e. your college/university) asked for your assistance with a budget allocation problem they’re facing. Originally, the committee ...
2
votes
1answer
472 views

Time schedule intersection

I had a job interview one of the questions was the following Given an api - you submit a name of a person and it gives back a sorted list of all the free time slots this person has. the list might be ...
8
votes
2answers
105 views

Function invocation every second time

Recently I got test task at the project, it is fairly simple: ...
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; ...
5
votes
4answers
433 views

Maximum character insertion

I would like to know any suggestions about to improve my code and/or get a better approach for this problem solution and your rating of my approach to the problem.(besides removing the ...
1
vote
1answer
77 views

T-SQL query Choose name of clients, concluded more than one loan agreement in 2010

QUESTION: Choose the name of clients, concluded more than one loan agreement in 2010, as the numbers and dates of issue of these contracts. Sort by name of the client and date of issue of the loan. ...
3
votes
2answers
236 views

Calculate the largest palindromic number from the product of two 6-digit numbers (100000 to 999999)

Are there any efficient ways to solve this problem, for example using bitwise operator? ...
3
votes
1answer
130 views

Jumping on the clouds

I have started the Hackerrank interview preparation kit. The first problem I have solved with Swift is as follows: Emma is playing a new mobile game that starts with consecutively numbered clouds. ...
7
votes
5answers
195 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
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 ...
3
votes
1answer
85 views

Find the largest product of an array

This task is taken from www.interviewbit.com Given an array of integers, return the highest product possible by multiplying 3 numbers from the array Input: ...
5
votes
1answer
14k views

Count duplicates in a JavaScript array

This is actually a hackerrank interview question I have already solved but I need guidance on how to optimize it for the Time Space Given an array of integers, your task is to count the number of ...
0
votes
2answers
64 views

Count Substrings for a binary string

Problem is taken from leet code. Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings ...
3
votes
3answers
246 views

Frequency analysis based anagram checker

I uploaded code solutions for some problems of the book Cracking the Coding Interview, 6th Edition to GitHub, I would like to know your rating and potential improvement of the code I wrote. Here is ...
7
votes
2answers
3k views

Searching in a sorted 2D matrix

If I was at an interview, and wrote this code, what would you think? Please be brutal. Time it took to wrote it: 13 minutes Problem: Write an efficient algorithm that searches for a value in an m ...
2
votes
3answers
135 views

The last standing gunman in a circle

I don't know why in most of the interviews, interviewers are asking this question commonly. The question is: There are n number of persons standing in a circle. ...
6
votes
2answers
103 views

Find matching dictionary words given a Scrabble tray

This is a question I was asked in an interview, below is a cleaned-up copy of the answer I gave. Apparently this answer was not satisfactory. How can it be improved? Question: Given a dictionary of ...
1
vote
1answer
89 views

Rotate matrix clockWise and counter clockWise

This code is a mix of the same question one time rotating to the right and one time to the left. I tried to simplify the code since I'm struggling with all of the indexing here. https://leetcode.com/...
3
votes
1answer
55 views

CareerCup (Bloomberg): Check if string is valid based on brackets

The goal of this problem is to determine if a string with brackets is valid. Below is a summary of the question from careercup. Check if string s is valid based on brackets ...
7
votes
1answer
144 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:...
4
votes
2answers
93 views

Find the in-order successor of a given node in a binary search tree

I have an implementation of an algorithm to return the in-order successor of a given node in a binary search tree. We are allowed to assume that each node in the BST has a reference to its parent node....
2
votes
2answers
67 views

Validating that a Java program has two equal-length arguments

I'm writing a small almost one method Java class for a job application and the advice given was to write it as though it was a piece of commercial software. The ...
2
votes
0answers
148 views

Event management system in C++

I have this question asked as home assignment for an interview. I submitted my solution and did not get selected. Wanted to know your feedback for the solution. Question: Write a very simple ...
7
votes
1answer
174 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 ...
5
votes
1answer
130 views

In-Memory database supporting transactions

I referred to the post here but it does not address the question that I have with regards to my implementation. I have a C# implementation of an in-memory database that I came up with during a recent ...
4
votes
1answer
179 views

SQL query to count loans issued during each week

Calculate the number of loans issued by the Regional offices for each business week in the period from 38 to 40 business week of 2011 inclusive. Sort by name of the regional unit, business week. ...
5
votes
1answer
80 views

PHP program to validate phone numbers from a file

As part of job interview, I was asked to write a cli script that takes a list of phone numbers to validate from a file and as an option in the command line. It will then produce a CSV file with three ...
5
votes
1answer
935 views

LRU Cache Implementation with HashTable and LinkedList

Problem Statement: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the value (will always be ...
54
votes
11answers
12k views

Sales tax calculator, rejected for being not OOP

I applied for an Application Developer position. They require all their applicants to complete 1 of 3 programming assignments. I picked one for sales tax calculation. It was quite simple. Write ...
3
votes
1answer
615 views

“Can a list of meetings all be scheduled in a conference room?”

I was given this question at an interview for a position I just got rejected by, so looking to improve and see what better answers there are! ...
4
votes
1answer
1k views

A tax calculator application to calculate tax and print final receipt

Although this question has been asked a lot of times, I was hoping for a feedback on my approach. Tax Calculator Basic sales tax is applicable at a rate of 10% on all goods, except books, food, ...