r/csinterviewproblems • • Dec 18 '15

Given a list of numbers between 0-99, print out the missing numbers and number ranges.

27 Upvotes

Input:

[0,1,5,7,27,54,55,56]

Output:

2-4,6,8-26,28-53,57-99

Source: Google phone interview


r/csinterviewproblems • • Dec 18 '15

Convert an integer < 4000 into a roman numeral.

25 Upvotes

input:

78

output:

LXXVIII

Source: Google phone interview


r/csinterviewproblems • • Dec 20 '15

Find a value in a sorted array of unknown length

22 Upvotes

You're given an array of integers sorted in ascending order. The length of the array is not known. Assume an exception is thrown if you attempt to read an array value that is out of bounds. Also assume that you don't have access to any properties or methods like: Length, Length(), Size(), Count, length, length(), len(), etc.

Determine if a given integer is present in the array. Determine the run-time complexity of your solution.


r/csinterviewproblems • • Feb 11 '19

Google Software Engineer Design Interview: Reservation System

17 Upvotes

I recently had a Software Engineering interview with Google and I wanted to share my experience.

https://youtu.be/6wSk5XG4jwU


r/csinterviewproblems • • Dec 18 '15

Given a list of strings, print out the groups of strings that are permutations of each other in O(n) time.

17 Upvotes

Input:

aaab
ddss
abaa
dsds
gg

Output:

aaab
abaa
ddss
dsds

Source: Lesser known SV unicorn company

EDIT: it's actually newline separated, I am unfamiliar with reddit formatting.


r/csinterviewproblems • • Apr 01 '20

100-Days-to-Amazon - Most frequent Amazon Questions with Algorithm and Code

Thumbnail
medium.com
16 Upvotes

r/csinterviewproblems • • Jul 25 '20

Interview Preparation Resources

14 Upvotes

I've compiled a set of resources for you to crack your next tech interview

Table of contents

Check it out at https://github.com/nabagata/interview-prep

Feel free to star/fork & contribute to add any resources which you think might be useful.


r/csinterviewproblems • • Feb 27 '20

Stripe Interview for Software Engineer in Dublin

14 Upvotes

I am from India and had the opportunity to interview with Stripe some months ago. Their interview process is a bit different than other top tier companies so I thought of writing a detailed blog post explaining everything about my interview at Stripe.

Please, feel free to leave any questions below and I can try to answer them. I hope it helps and all the best in your preparation.


r/csinterviewproblems • • Jan 12 '16

Given an array of n integers, find the minimum value in each subarray of size k.

14 Upvotes

Example:

Suppose you're given:

array = [5, 2, 8, 4, 6, 9, 10, 1] and k = 3

Return:

result = [2, 2, 4, 4, 6, 1]

Because:

2 == min(5, 2, 8)
2 == min(2, 8, 4)
4 == min(8, 4, 6)
4 == min(4, 6, 9)
6 == min(6, 9, 10)
1 == min(9, 10, 1)

Return minimums in order from left to right.

Easy:

Solve in O(nk) time and O(nk) space (excluding output size in space complexity).

Solve in O(nk) time and O(1) space (excluding output size in space complexity).

Medium:

Solve in O(n lg n) time and O(n) space (excluding output size in space complexity)

Solve in O(n lg k) time and O(k) space (excluding output size in space complexity)

Hard:

Solve in O(n) time and O(n) space (excluding output size in space complexity)

Solve in O(n) time and O(k) space (excluding output size in space complexity)


r/csinterviewproblems • • Dec 19 '15

Given an array of integers and a partition index, switch the two partitions of the array in O(1) space and O(n) time.

14 Upvotes

input:

[1,2,3,4,5,6,7], 4

output:

[5,6,7,1,2,3,4]

input:

[1,2,3,4,5,6,7], 6

output:

[7,1,2,3,4,5,6]

Source: onsite interview with private B2B company worth a couple hundred million


r/csinterviewproblems • • Nov 15 '20

How to prepare for Uber's CodeSignal?

13 Upvotes

Hey fam! I have been asked to take a test on Codesignal and the stakes are high as ever - I cannot afford to do any mistake. How do I prepare for it specifically?

I want to prepare my best and I have 5 days left for the test to expire. My coding abilities are decent (have cracked the algorithmic and data structures rounds of companies like Amazon, Bloomberg, etc in the past) but need to take care of this CodeSignal (four questions in 70 mins).

The prep material for the test is as follows:

Task 1: This focuses on working with numbers, basic string manipulation, and basic array manipulation and requires a combination of 2-3 of these concepts. Requires 5-10 lines of code and the average time for solving this task should be 10 minutes.

- Task 2: The focus is the same as the 1st task but with slightly more complex implementation and requires a combination of 3 to 5 the above-mentioned concepts. The solution typically requires writing 10-20 lines of code and the average time for solving this task should be 15 mins.

- Task 3: In addition to the knowledge demonstrated previously, this task will involve splitting a task into smaller subtasks/functions, manipulating two-dimensional arrays, and using hashmaps. You may be required to write 25-40 lines of code and the average time for solving this task should be 20 mins.

- Task 4: In addition to the knowledge demonstrated previously, this task will involve working with trees, understanding hashmaps, fundamentals of discrete mathematics, and brute-force search. You may be required to write 20-35 lines of code and the average time for solving this task should be 25 mins.

Leetcode has a fair amount of Uber tagged questions, should I prepare them? I could not find many tagged questions for Uber+Codesignal on Leetcode and be wondering what resources should I use. Thanks in advance!


r/csinterviewproblems • • May 22 '18

Just had a phone interview with a big 4 and had this problem that I couldn't solve efficiently. Help please?

13 Upvotes

Ok part 1: "Write a function that, given a 5 letter secret, and given a guess, return '1 offset, 1 match' if the guess contains 1 match at the correct position and 1 character but at the incorrect position". I was also advised to return something useful as it would be used in part 2.

I did that part and I return a array (array of correctness) with 2 numbers: r[0] = number of offsets, r[1] = number of matches.

Part 2 (the problem part!): Given a secret, and a history of guesses, use the list of guesses and their corresponding arrays of correctness to narrow down the possibilities or outright get the correct secret.

I thought of a lot of ways to solve this: tries (which would work), HashSet of all the possible characters and removing characters for that hashset that have an array of correctness of [0,0].... I just ran out of time.

Can anybody help please?


r/csinterviewproblems • • Apr 05 '20

Wrote an Article on my CS Interview Prep and what I did!

12 Upvotes

Hey everyone I wrote an article about how I prepped for interviews at Amazon, Facebook, and a few other big companies and which made me land the job I have now. I would love some reviews from the community thank you!
http://thecodersstruggle.com/2020/04/05/software-engineer-interview-what-to-expect-and-how-to-prep/


r/csinterviewproblems • • Jan 05 '17

When it comes to whiteboard coding interviews, remember to PREP

12 Upvotes

PREP is a mnemonic I created to help you remember the steps involved in solving whiteboard coding problems. It stands for Parameters, Return, Example, Pseudocode.

Here is an example of using PREP to work through a beginner-level coding problem.

https://medium.freecodecamp.com/before-you-code-remember-to-prep-for-your-coding-interview-2ccfb58147db#.t3x7bv1zu


r/csinterviewproblems • • Dec 19 '15

Sticky: Discussion Thread

12 Upvotes

Hey coders,

I'm really glad so many people are using this sub. I was not expecting it to be so popular. We are on trending subreddits today! Thanks to everyone submitting questions and answers. I've already been taught some things by other Redditors that I would not have picked up studying on my own. Pretty cool!

I want to reserve the posts for coding problems only, so I figured I'd create this sticky if you want to discuss interview strategies, or make suggestions for the sub, or anything else.

Also, just a reminder: when submitting a question, please try to make sure there are enough details in the text body, along with sample input and output where appropriate. No need to go crazy, but a couple sentences are helpful.

Edit:

Ok, let me lay down this rule in case it's not clear. If you insult people or use rude language you will be banned. Be a fucking adult please.

-parlezmoose


r/csinterviewproblems • • Apr 15 '21

Intimidating internship interview

11 Upvotes

I had an interview earlier today for an internship in cybersecurity and it was the most uncomfortable miserable hour long experience. I'm making a career change with basically no hands on working experience. The first 5 minutes of the interview kept asking what experience I had in a few areas, which was none. Then the next 55 mins was an oral pop quiz on all sorts of technical stuff I didn't know about. I've had 8 other internship interviews in the last 2 weeks and none of them were like this. It was so damn intimidating that if by chance they do actually call me back I would turn it down. If the interview for a freaking internship was that intimidating I couldn't imagine working for them. I wish I was more prepared for the questions I was asked, oh well.


r/csinterviewproblems • • Feb 23 '21

Got shortlisted for Google phone interview

11 Upvotes

Hello, I just got the mail that I got shortlisted for a phone interview at Google for a Software engineering, early career GCP post. Also what does early career mean? I had applied to some jobs at Google and other companies without really thinking much about it or being prepared for it. Now I am not sure what I should do. What do I study? Also if I get rejected in the phone interview (which is likely to happen) How long do I have to wait for applying again? I would take atleast 2-3 months to maybe feel confident enough to apply again, but will they automatically reject me whenever they see my resume later? Thanks


r/csinterviewproblems • • May 09 '16

Take a string and reverse the order of the words without any additional memory.

11 Upvotes

Take a string and reverse the order of the words without any additional memory.

Input "this is a sample input" Output "input sample a is this"


r/csinterviewproblems • • Dec 18 '15

[Easy] Create an output of a 12 X 12 multiplication table

11 Upvotes

The first coding job I interviewed for this was the first question they asked me and I was grateful because it was pretty easy. Keep in mind that you should care what the output looks like in the console (the numbers should line up). I only had 10 minutes to complete this and it was pseudo code done in java.


r/csinterviewproblems • • Jun 19 '20

15+ Binary Tree coding challenges from FAANG Interview

Thumbnail
medium.com
10 Upvotes

r/csinterviewproblems • • May 13 '20

Anyone ever failed a technical interview badly

10 Upvotes

I have a technical tomorrow and im extremely nervous. I went through a list of problems called blind 75. So far I've only completed 35 so I just know I'm screwed tomorrow. Its for a swe internship at G. I just wanted to know if anyone of you have ever failed badly. Im just picturing myself just sitting there not knowing what to do, no thoughts going through my head. Maybe I slipped through the cracks and im an imposter😬😔


r/csinterviewproblems • • Mar 11 '20

My complete interview experience with Spotify for their Backend Engineer II position

Thumbnail
blog.rampatra.com
10 Upvotes

r/csinterviewproblems • • Mar 24 '16

Create a program version of War

10 Upvotes

Create a program version of the card game War. For those unaware the rules to war are as follows:

  • Shuffle an ordinary deck of cards and deal the entire deck evenly amongst all the players (there can be as many as you like, but the game usually caps at around 4 players).

  • Every round, players play the top card of their deck face up. The cards are compared and the player with the highest value card takes all of the played cards and puts them on the bottom of their deck.

  • In the event of a tie, the tied players play the next three cards off their deck face down then one more face up. The face up cards are then compared as above. In the event of a tie, do it again.

  • The game is over when one player has all of the cards. Any player who loses all of their cards is out of the game.

For extra credit, come up with both a procedural way to program this and an object-oriented way.


r/csinterviewproblems • • Jan 15 '25

Has the tech job market peaked?

9 Upvotes

I'm an ex-Google software engineer who left to pursue entrepreneurship. I've worked in the industry for about 10 years, and I've noticed several shifts in the industry that all don't seem to bode well for us rank and file employees.

  1. Job interviews are getting harder. There's increasing competition for fewer roles. There's seemingly a higher level of distrust of candidates. Which makes sense also given there's now AI tools that literally help people cheat their interviews.

  2. Fewer companies are hiring. Big companies like Google, X and Meta are virtue signaling investors about efficiency. They're using layoffs to signal their commitment to culling low performers. Meta just announced a 5% cut in preparation for an "intense year".

  3. More panic. When I check my internal company Blind, or subreddits here, I see a lot of fear and uncertainty about layoffs. It seems like everyone is expecting the hammer to drop, and conditions to get worse.

Honestly, given the advancements in AI (I use it myself to code), software engineering is changing. Intelligence is literally becoming a commodity, where companies can now turn electricity into business AI agents that do the jobs of humans, without benefits, a salary, insurance, or any complaints.

I don't wish to sound doomer, but how are folks handling this? Are you still attempting to interview? If so, how does your interview prep for CS look? I'm also worried if I need to go back to the job market, myself.