Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [interview-questions]

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

2
votes
1answer
50 views

The last standing gunman in a circle

I dont 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 ...
1
vote
1answer
42 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
45 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 ...
2
votes
2answers
55 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
90 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
115 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
84 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....
0
votes
1answer
16 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. ...
2
votes
0answers
16 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 ...
4
votes
1answer
175 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. ...
7
votes
1answer
132 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
63 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 ...
2
votes
0answers
49 views

Longest Palindrome Substring: Where is the dynamic programming? [closed]

In this LeetCode problem, Longest Palindromic Substring, it is listed under Dynamic Programming for Google interview preparation. My understanding of dynamic programming is roughly "recursion + ...
3
votes
1answer
44 views

Adding two numbers represented as linked lists

I have some imminent interviews and want to sharpen my game before going into them. I'm running through some practice problems. This LeetCode challenge is to add two numbers represented as linked ...
1
vote
2answers
126 views

Leetcode - find if BST is valid or not

Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node'...
3
votes
2answers
62 views

Leetcode - First Unique Character in a String

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: ...
1
vote
1answer
24 views

Leetcode - product of array except self

Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example: ...
1
vote
2answers
159 views

Leeetcode - Best time to buy and sell stock to get maximum profit

Question Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one and sell one ...
4
votes
2answers
283 views

How to set an interval to std::map [closed]

This code belongs to a contest. I tried to apply the range of data to a std::map. The contest system however warns me that the implementation of the assign function ...
2
votes
2answers
50 views

Find all k points which are closest to origin

We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is the Euclidean distance.) You may return the ...
1
vote
1answer
37 views

Depth-first traversal implementation in Java (by recursion)

I implemented a recursive depth-first traversal, with all three traversal modes in this function. Is this the most succinct way to write the code? ...
4
votes
5answers
113 views

Find the smallest element in a sorted and rotated array [closed]

I was solving a question asked in interview by Uber. It says: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. Find the minimum element in \$O(\log n)\$...
3
votes
2answers
85 views

Design a sustainable home tracker and calibrater for power, water, gas to minimize the expense

Problem Statement Following are the various scenarios to be considered Track energy - Track consumption of water, gas and electricity. We should be able extend to capture other type of ...
2
votes
1answer
142 views

Implement Queue using fixed size array

I came across below interview question and I am working on it: Build a queue class with the enqueue and dequeue methods. The queue can store an UNLIMITED number of elements but you are limited to ...
3
votes
2answers
160 views

Trip planning algorithm

I was presented with an interview question described as follows: Receiving an int[] A of cities, where each A[i] has an appeal ...
5
votes
1answer
124 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 ...
2
votes
1answer
66 views

React board game app

I was told to code a board game app using React for a job interview. They told me they chose other candidates to move forward with, so I was wondering on what I could improve. The full code can be ...
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 ...
2
votes
2answers
56 views

Solve Robot Paths using backtracking

I got this problem during a mock interview, and I would like to get code review for the backtracking solution. I include 7 test cases, and my solution passes 7 out of 7 test cases. See the online code ...
7
votes
3answers
238 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 ...
4
votes
1answer
85 views

Find Shortest Word Edit Path in python

I was given this problem in an interview. Given two words source and target, and a list of words ...
1
vote
2answers
103 views

Simple Console Address Book in C# using Dictionary

I have created a simple C# console app to display an Address Book using Dictionary. I would like to present it in a interview but I am not sure if the code is "interview" worthy. Given below is the ...
4
votes
1answer
183 views

Reverse int within the 32-bit signed integer range

Problem Reverse digits of a 32-bit signed integer. When the reversed integer overflows return 0. Optimized code here. Feedback I'm looking for any ways I can optimize this with modern C++ ...
13
votes
2answers
630 views

Count the occurrence of each unique word in the file

I've been doing a task for an interview that I will have soon. The requirement is to code the following problem in C#. Write a program (and prove that it works) that: Given a text file, count the ...
3
votes
1answer
87 views

Given a search string, fetch all movies results from the api

Was told this code was 'weird' and didn't pass the coding test. I tried to split up to show the different levels of abstraction but maybe I went overboard? I told them this in the walk through of the ...
8
votes
1answer
182 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 ...
2
votes
1answer
92 views

Simple pattern matching between two string inputs using Java (Google interview challenge)

The interview question is: Write a function isMatch (without using java.util.Regex) that takes two strings as arguments: ...
3
votes
2answers
88 views

Longest common subsequence solution

I've seen this today on a mock interview and wanted to give it a try. I'd love to hear some feedback from you guys. This is my second attempt at the problem, initially I had a mess of ...
3
votes
1answer
146 views

Counting subtrees where all nodes have the same value

A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value. Given the root to a binary tree, count the number of unival subtrees. For example,...
5
votes
3answers
78 views

Print out N by N Spiral Matrix in javascript

I got this question during my practice interview. Matrices - N Spiral Matrix Prompt Given an integer N, output an N x N spiral matrix with integers 1 through N. Examples: ...
0
votes
0answers
131 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 ...
5
votes
1answer
224 views

Graph puzzle resolver

I've solved test task for job vacancy. Need your feedback about my solution. Task The image below shows the puzzle in the solved state. The puzzle consists of 10 cells. Among the cells one is empty, ...
4
votes
2answers
86 views

Simple person manager console-app

The code below is for a coding challenge for a job. I have everything working as they requested, I've reviewed it myself and believe everything is good. I'm just looking to see if anyone see's ...
4
votes
1answer
77 views

A simplified Tetris solver

As part of an job interview process, I was tasked to write a solver for a simplified Tetris game using JavaScript. The game board size is 4x4 and there are 4 different pieces given in a .txt file. It ...
1
vote
0answers
76 views

Automating A Workflow Using Selenium - Best Way To Fetch Elements & Make Code More Generic

I'm a newbie to Selenium and I'm trying to get better at it by taking up interview assignments. This YouTube link describes the workflow that needs to be automated. The following points are worth ...
2
votes
2answers
81 views

Return array with products of old array except i

Coding problem: Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. My ...
2
votes
2answers
79 views

Is the sum of 2 numbers in list k

I got a coding problem to solve and was wondering if I got a commonly acceptable and efficient/clean solution. If there is a better way I'd gladly hear it. given a list with numbers return if the ...
0
votes
1answer
49 views

Find array index with element equality in Python

I was given this question during an interview. It is similar to binary search and I would like to ask for feedback for my solution. Array Index & Element Equality Given a sorted array arr ...
-1
votes
2answers
120 views

Two-sum solution in JavaScript [closed]

I was given this question during an interview. It is similar to two sum problems and I would like to ask for feedback for my solution. Merging 2 Packages Given a package with a weight limit ...
1
vote
2answers
82 views

Bracket matcher in Python

I would like to receive feedback on my coding interview for the following problem: Bracket Match A string of brackets is considered correctly matched if every opening bracket in the string ...