Questions tagged [interview-questions]

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

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

Largest Sum Contiguous Subarray - Kadene's algorithm

I am looking forward to an answer to improve this code? Thanks. Test class ...
4
votes
2answers
144 views

Checking if a string contains all unique characters

I am currently reviewing CTCI(Cracking the Coding Interview) The question is asking me to implement an algorithm which checks whether the characters in a string are all unique however they do not want ...
4
votes
2answers
70 views

Replace nested property for an interview

During an interview I was given this interesting JavaScript task: Given the code: ...
4
votes
0answers
54 views

c# Efficient solution: Sequence generator for a pattern

This is an interview question to generate the below pattern of numbers in a sequence, which is: 12.34, 23.45, 45.67, 78.910, 1112.1314, 1617.1819, 2223.2425, 2930.3132, 3738.3940, 4647.4849, 5657.5859,...
2
votes
1answer
73 views

The intersection of two polygons in C++

I implemented the intersection of two (convex) polygons in C++. It finds the polygon in the intersection like in this image. Looking for any and all feedback. I left the logic for line intersection ...
5
votes
2answers
77 views

Sorting squares of an integer array

I had this question in an interview recently. Given a sorted array of integers, return a list of those integers squared, with the squares sorted. So given an array of these numbers: ...
1
vote
3answers
113 views

Refactor Java code

I was trying to solve the following question: You are given 2 arrays: one representing the time people arrive at a door and other representing the direction they want to go(in or out) You have to ...
1
vote
2answers
77 views

Cut Wood / Facebook Interview

This question was asked through the Facebook interview and the suggested solution is solving via binary search. I have put the binary search solution but it still looks too complicated. Question: ...
3
votes
2answers
101 views

Board Rotation Problem - Best Practices

Problem: You are given a board containing lower-case letters and a word that you have to form. You can only take the letters from the front or the back, hence you have to rotate the board left or ...
1
vote
1answer
55 views

Counting the number of click on the entire page

In an interview I was giving the following problem: Count the number of click on on the entire page. Can you think of a better way to do this? ...
1
vote
2answers
68 views

Merge two sorted arrays that can be of different sizes

I think the algorithm implementation itself is reasonably efficient, but I'm not sure about proper use of good practices in software development in the code (variable naming, idioms, comments, error ...
2
votes
1answer
67 views

Propagation in grid

Can I do it with a lower Big O / better code? How can I improve this solution? Task: Let's assume we have a array like this: 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 ...
3
votes
2answers
84 views

Finding average of stream of numbers

A Brief Context I recently gave an interview in a company where I was asked this particular question. After the interview was over, the HR gave the feedback that my solution (is correct ...
2
votes
1answer
66 views

Is there a route to the end of the jump table?

I'm currently learning about Dynamic Programming and solving a "coding question" related to the topic. Given an array of non-negative integers, you are initially positioned at the first ...
12
votes
3answers
2k views

Converting Roman numerals to integers

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. ...
1
vote
2answers
321 views

Calculate transaction balances and find duplicate transactions

In an interview I was asked to solve two JavaScript questions. I thought I did pretty well because I: Covered the edge cases Wrote comprehensive tests Documented the code using jsdoc The interviewer ...
4
votes
2answers
217 views

Query and display train and station information

Recently got this coding assignment as the first round of interview at a tech organization. I could get the expected result, however, my code failed the best practices check. Please let me know if it ...
1
vote
0answers
33 views

Wildcard Matching with DFS and FSM

I'm trying to solve Wildcard Matching on Leetcode. I found a great solution using the Finite-state machine. The author builds an FSM and searches with BFS. I rewrite the solution with the same idea (...
2
votes
0answers
72 views

ANDROID - Receive and manage markers in Google Maps

Recently, I've received negative feedback of interview's test. They say that they need somebody with higher technical level, the quality of the task was not good enough. I upload it here, to request ...
4
votes
0answers
79 views

Implement a micro service in Rust

Last year I tried to implement a micro service architecture in Rust. It was asked as a homework question in an employment interview process to be completed in a few days. The imagined use case was a ...
1
vote
1answer
68 views

An app displaying items fetched from JSON, but I think maybe I'm not using best Android development praxis

I have been programming in various languages for a very long time, and this was one of my first attempts to build an Android app. Apparently this was not good enough for the challengee, could somebody ...
3
votes
2answers
175 views

Access a database and an API, uses python generators, and matches the results based on names, interview assignment

Thanks in advance if you are reading this code. I recently submitted this code as part of an interview (took about 4-5 hours). Unfortunately, they did not like the code and I received a form ...
3
votes
1answer
84 views

Find the smallest number of perfect squares that sum to a target

Given a positive integer n, find the smallest number of perfect squares (for example, 1, 4, 9, 16, ...) that sum to n. ...
1
vote
1answer
853 views

Go homework interview challenge for Storj

Last December I interviewed with Storj and was unsuccessful after my code challenge. Storj were good enough to pay me for the time it took to complete the challenge, but have refused to give any kind ...
5
votes
1answer
131 views

Toy Robot Simulator

I know this code worked as I've tested it with the case tests commented below in the code, and even added a few of my own, but the developers who were testing me came back with the following critiques:...
2
votes
2answers
204 views

Convert integer to English words

I was recently asked an interview question with regards to algorithm design. The challenge is as follows: Given a 6 or less digits positive integer (0 - 999999 inclusive), write a function ...
0
votes
2answers
186 views

Facebook coding interview [closed]

I have joined the Facebook interview recently. And the following question has been asked on the coding interview. ...
6
votes
2answers
236 views

Data analysis program for job interview

Before the interview for the Junior (i hope:)) position of Java developer, I was asked to do a test task. Kindly ask you to review my code. Riht now program arguments are hardcoded and not from args[],...
3
votes
1answer
52 views

Traversing from left or from right - Leetcode 140: Word Break II

I have watched Professor Sheep's Leetcode 140: Word Break II YouTube video here CPP code here My own Python translation code is below. I am thinking that the code can be optimized by traversing ...
7
votes
2answers
171 views

Interview Code Test: Webservice Checker

I recently applied for a job as a C# developer. Based on the first phone call, they wanted to check my skills with a code interview in Java. Since I haven't programmed Java for years, I tried my best, ...
0
votes
1answer
323 views

Insert a digit to maximize the given number

Was asked in an interview today - You are given an integer (in finite range [-N, N]) and you wish to maximize the number by inserting somewhere the digit '5'. My solution - the idea here is going ...
3
votes
1answer
109 views

Find number of horizontal brush strokes to paint a skyline

Asked in interview today: You want to paint a skyline on your wall using only horizontal brush strokes. You are given an array of numbers, each representing the size of the column/building in that ...
1
vote
0answers
65 views

Tic-tac-toe vanilla js

I'm trying to improve my interview skills so I wrote one of the typical assignments - tic-tac-toe game. The main goals are: time limit: 30 minutes - 1h use only vanilla js I'll attach source but I ...
0
votes
1answer
61 views

Choosing between 2 Fibonacci alternatives [closed]

Task: Return the fibonacci value at a given index. e.g: input: 6, return: 8. Algorithm 1: ...
3
votes
1answer
137 views

Algorithm to find the Array Balance Point

Task: Find the balance point of an array; return the index that if you break the array into left and right at that point will ...
8
votes
1answer
233 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 ...
7
votes
3answers
587 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 ...
2
votes
1answer
218 views

LeetCode: Greatest Common Divisor of Strings C#

https://leetcode.com/problems/greatest-common-divisor-of-strings/ For strings S and T, we say "T divides S" if and only if S = T + ... + T (T concatenated with itself 1 or more times) ...
5
votes
3answers
409 views

C# Bowling Game interview test

I recently interviewed for a software engineering job that requires at least one year of C# and experience with the Microsoft stack. Even though I made it clear at the outset that I had zero ...
1
vote
2answers
162 views

Unit tests for anagram finder

I did this test for a job and the feedback was: "while many were added to test private methods, they did not do anything to ensure the public interface worked correctly, edge cases were missed" But ...
4
votes
1answer
540 views

LeetCode: Rotting Oranges in C#

https://leetcode.com/problems/rotting-oranges/ Please review for coding style in 40 minutes job interview. In a given grid, each cell can have one of three values: the value 0 representing an ...
6
votes
4answers
211 views

Building a toy from Lego toys

I recently attempted a coding problem, but my solution was not well received during the interview (modified slightly to reduce Google-ability). Suppose a child has several Lego blocks, and wants to ...
8
votes
2answers
701 views

Analyzing records of London Underground outages

You have a file that describes historic data of the London Underground showing dates when stations have been unavailable. The file contains these fields, separated by a pipe character: Date: ...
3
votes
2answers
117 views

Parcel size classifier [closed]

I submitted a technical assignment for a job interview process and I am stressing out wondering if my submission was any good. I would like to learn and be a better developer, so please give me ...
5
votes
1answer
144 views

Decode ambiguous Morse code

Stumbled upon this interview question: Given a morse encoded sentence with no spaces or separation between letters or words and a list of words contained in the message, decode it. This was my ...
5
votes
1answer
66 views

An alternative algorithm for sorting a stack using only one additional stack

From "Cracking the Coding Interview": Write a program to sort a stack in ascending order (with biggest items on top). You may use at most one additional stack to hold items, but you may not copy ...
2
votes
1answer
223 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, ...
7
votes
1answer
83 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 ...
3
votes
1answer
60 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 ...
6
votes
4answers
152 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) ...

1
2 3 4 5
18