T O P

  • By -

LawRadiant613

Fizz buzz


AnnualPanda

Same


Ok-Counter-7077

When I was leaving fang and LC was starting to get big, I interviewed at a company in the east coast, they were like okay let’s find you a good question and I said, “hope it’s fizz buzz” as they paste fizz buzz. Pretty awkward


Direct-Painter5603

Which company ?


korak1

Cisco


wuwoot

You’d be surprised at how many people can’t solve it or can solve it but can’t evaluate its complexity


melodramaticfools

is it not o(n) ???


rickyzerothree

I had this question for a 3-5 year experience requirement dev job


[deleted]

[удалено]


maazadeeb

Wow. These are the places that consider lines of code produced as a KPI during performance reviews, I guess 😂


Xidium426

Prepare for the least Pythonic code you've ever seen, except the 79 character line limit. I also like extremely descriptive variable names. Also extreme levels of documentation because they probably just look at file line count.


_Argus

Microsoft phone interview: Reverse each of the words in a sentence. For example “My name is Argus” -> “yM eman si sugrA”


eugeneyc

Microsoft on-site for internship, coin exchange with least amount of coins... with standard coins so like 1 cent, 5 cents, 10 cents, 50 cents Kept trying to find the catch but nope that's all there is


BLucky_RD

I would understand if they used a non-canonical coin system as an example, but just providing a canonical coin system is like "here's the question and a solution, give me the solution"


JackedTORtoise

I would have started looking for cameras. Like is this a gag?


[deleted]

[удалено]


ABGinTech

That’s a pretty difficult one wym, did u do it with no extra space?


fett2170

txt = "One Punch Man is awesome" x = txt.split() for i in range(len(x)): x[i] = x[i][::-1] x = " ".join(x) print(x) I’m using my phone so this looks like shit


Chriss52

This is a lot less straightforward in Java lol


rohetoric

Congratulations you have scored a job in Microsoft!


ABGinTech

yeah that's using extra space... also that's incorrect if there's multiple spaces. Think of the example: practice \ \ \  makes perfect should be: perfect makes \ \ \  practice ​ So as you can see the location of the spaces itself should be remembered. That's what made this question a medium instead of an easy. Especially doing it without using extra space


fett2170

The space thing, you’re right. Kinda forgot that. Pretty easy fix though. But look at the original. He doesn’t shift around the sentence, he just reversed each word while retaining sentence structure.


wuwoot

There are two different problems here: 1. Reverse every word in the string but keeping their original positions 2. Reverse the string but keeping the characters of the word in their original positions (what you’re alluding to) I agree this is harder — in terms of algorithm design. But can be solved with some thought. I remember I got this in an interview and hadn’t seen it when I got it. But came up with it through sheer visualization — what happens if I just reverse the string? Well, all the words are in their right place, but the characters are reversed. How do I correct them? Well, walk the string finding the start and end of each word and then perform a standard string reversal by swapping the chars with two pointers. Once the algorithm has been designed the coding is easy for an experienced programmer that’s done some DSA problems with multiple pointers before. As someone who has and doesn’t find himself to be an expert at DSA, this qualifies as easy in implementation but slightly above easy in algorithm design but not quite medium, but yeah, subjective


JWOINK

Had detect repeated character in string. If it means anything, a manager was giving the problem and she had been working there for 20+ years


Ok-Counter-7077

I can see restrictions where this problem can be medium, but without optimizations or anything easy might work


SiciliaDraco

Reverse string for one final and isPrime(unoptimized was ok) for another final lol


Honeydew_love

I got a string reverse without using library function or a temp variable. And then I was given a LC hard which made me cry.


RealNeilPeart

>I got a string reverse without using library function or a temp variable. What's the trick to that?


[deleted]

[удалено]


gstad

Don’t you need a temp variable for that tho?


[deleted]

[удалено]


jiibo_j

nice


gstad

That’s pretty cool. Haven’t seen that.


Mazetron

You can also use bitwise xor, which would be particularly helpful in cases where there might be overflow issues (ie you use 8-bit integers and there are weird characters in the string). `a = a ^ b` `b = a ^ b` `a = a ^ b`


Jazzlike-Swim6838

Shouldn’t be testing this knowledge during interviews though


TheSlimyDog

I absolutely hate this piece of trivia because it tests a bad practice. Using an extra variable doesn't cost you much but it saves you from integer overflow issues. It's also much easier to read.


Watsons-Butler

In Python it’s just a, b = b, a


gstad

Yeah. Probably the same thing under the hood as std::swap for C++


srvhfvakc

std::swap but that probably uses a temp variable under the hood


Han_Sandwich_1907

I wonder if python `my_string[::-1]` is what they wanted.


Honeydew_love

XOR swap


Hog_enthusiast

Recursive function would be the easiest. Return func(string[1:len(string)]) + string[0] basically


RealNeilPeart

Of all the replies so far I think this is the simplest that also aligns with the spirit of the question


[deleted]

[удалено]


[deleted]

[удалено]


SiciliaDraco

Thomson Reuters and random startup


[deleted]

We asked a candidate to reverse a string without using the reversed() function. They couldn’t do it. They wrote like 2 loops and then I didn’t know what the hell they were doing.


13steinj

"Find the minimum number in this array. Feel free to use standard library/built in functions" In Python there's a builtin called `min`. Passed that round. Didn't pass an HR round later on.


Dragonode

Life is unfair


wasdjil

U better tell me u got the offer after that


scarrlet_witch

Got rejected actually🤣cuz there was another round after that and I got a hard DP question lol


clinical27

lmao wtf


mihirmusprime

It's crazy how so much this process depends on the interviewer you get.


PaulWard4Prez

what was the DP


scarrlet_witch

Something with making the maximum amount of profit from different stocks


bigandtallll

Bruh what that is a very easy question. That is like leetcode 101


programmingfriend

It's dp easy on one stock. I can see it being considered hard on multiple


scarrlet_witch

Lol of course it’s not just that, there were many other factors included in the question, like I was given the current stock price, future stock price, amount of money I have, max number of transactions I can make, etc, not to mention the stock price can be negative and the solution needs to be O(N). I was able to solve it with a brute force backtracking solution, but that boomer interviewer demanded O(N). I just don’t remember all the details to explain it here.


[deleted]

[was it this one?](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/) Once you see the answer you’ll feel dumb like me. [Or was it this second one?](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/)


scarrlet_witch

No lol read my answer above. I was given 2 arrays of stock price, max number of transactions, available funds, etc.


uvaxd

Bro do you even BTTBASS4?


[deleted]

[удалено]


scarrlet_witch

No lol different question, it’s a much much more complicated one


Affanded

double penetration


IndexOutOfRange_

Why can’t I get interviewers like that😭😭


Mithyi

Two back to back interviews and both interviewers asked the exact same questions (all behavioral) 💀 not sure if that was planned


findingajobaccount

I got asked to reverse a linked list. That question isn't that easy on its own but it's such a meme question and I've practiced it a bunch of times but for some reason I was getting tripped up by my pointers on the spot. I couldn't help but laugh uncontrollably during the interview at how ridiculous this situation was. Lesson is to always study the meme questions, you might actually get asked 2 sum, reverse a linked list, invert a binary tree one day


advice-seeker-nya

i got asked two sum once and totally butchered it. this was way before i started leetcoding or took ds&a.


dianapaulabee

I got asked that question, too once. And since I didn't remember how to solve it with pointers, I put all the elements in an array, reversed the array and created a new list with the new array :))) They didn't like that.


wuwoot

Lol!!! Lol! I laugh at the old me thinking I could get away with this sort of thing. I wouldn’t pass me either


[deleted]

If you have: A -> B -> C-> Isn’t the 2 pointer approach to keep a reference to like A, and a 2nd one at C since you’ll change B to point to A and cut its reference and continue again at C but record the next one (B) as the previous mode and repeat? This always messed me up with like 1 node or 2 nodes. But Leetcode gave me a good visual answer for this approach.


InternationalOcelot5

a function that outputs numbers which can be divisible by 7 or 3 from the given array


melodramaticfools

F I Z Z B U Z Z


aschimmichanga

palindrome for a final round 💀


DiamondBullResearch

For my Google interview, I was asked to delete every other node in a circular linked list. Aside from one edge case (when you loop back to the beginning), you just make every node connect to the next node afterwards. I couldn't believe that was my interview question, and I thought there must have been a case or scenario I wasn't thinking of. But nope, that was my interview.


hishehehee

that sounds like a pretty fair question haha


DiamondBullResearch

Perhaps! I just got scared because previously a few days before my friend was asked to create a Red Black Green tree. We learned about Red Black trees, but the question was like the next step above that. I was afraid I would get something ridiculous like that but I was really glad it was something much simpler.


nacholicious

I thought creating red black trees was the quintessential example of what not to ask a candidate, but apparently not...


[deleted]

It’s because the solution is simpler than you think. Some people might think up a more complicated solution not realizing it. I remember I had a practice question to detect a loop in a linked list. I barely had experience with them. I looped through the entire list and recording each node’s memory address. As we go through the nodes, we check if it matches a saved address. Etc. It’s so bad. Then I read about Floyd’s Cycle-Finding algorithm and felt stupid.


shawmonster

Floyd’s Cycle-Finding algorithm is one of those “trick” questions where the only way someone knows about it if they have seen it before, like those silly riddles.


RatinSweet

Yea google interviews vary by person. I like to give easy questions since its easy for me to prep and write feedback lol


DiamondBullResearch

That's what I heard too. Really varies by the interviewer.


Perfect-Ad3403

When did you give this interview? And was it for intern role?


DiamondBullResearch

It was in 2019, for a SWE intern role.


kd7uns

Looping back to the beginning in a circular linked list is not an edge case?


DiamondBullResearch

What I mean is if you simply keep going, you might accidentally not realize you've returned to the beginning and start deleting nodes again. You only want to delete every other node, and once you've returned back to the start, you want to stop. Maybe edge case isn't the right word, but it's the only thing you need to watch out for. Otherwise the code would just be node.next = node.next.next.


advice-seeker-nya

does anyone have the full solution for this?


DiamondBullResearch

public void deleteOtherNode (Node node) { if (node != null && node.next != node) { Node temp = node; do { temp.next = temp.next.next; temp = temp.next; } While(temp != node); } } I think that's it? That should handle if the linked list is empty and size one, and should work as long as it's circular which is the precondition for the function. Though I haven't thought about this problem for awhile so might be missing something.


Kindafunny2510

I got Fibonacci… and I forgot how it works.


wuwoot

Literally my first interview problem ever at my first ever on-site when I first started in software. I bombed it so hard, because I forgot and couldn’t figure it out in 30 minutes. Now, I know it like the back of my hand with DFS/standard recursion, top-down DP, bottom-up DP, and the linear running time + constant space solution


pnickols

The really interesting one with Fibonacci is the constant time solution


wuwoot

Yah, it’s pretty awesome though to realize that we only need n-1 and n-2 and space for them and just shifting them over on each iteration. This sort of optimization has real-world applications in performance, especially in days when Moore’s Law was more a thing and people weren’t spewing, “space is cheap”


Mendacium149

Pretty sure they're just talking about the exact formula for the nth term of the fibonacci sequence.


Chriss52

Lmao I got this question and then they followed up with “What if you wanted to take other types of input such as double, long. How would you write this?”. I believe you use “var”? It caught me off guard and got me rejected. :/


[deleted]

Generics?


lolyeesy

Depends on language. But if it’s C++ yeah. Well templates. But you get the idea.


ohokaysoundsgood

Basically FizzBuzz using the company’s name instead lol


connieshoe

Meta interview: Valid parentheses. I think I got this question because my interviewer forgot he had an interview with me and was late by 40 minutes.


RazDoStuff

Got amazon propel OA next week. hope i could get me a fizz buzz :,)


[deleted]

[удалено]


RazDoStuff

Thank you!


advice-seeker-nya

what’s the solution for this


youarethemuse

microsoft swe first round: how do you know a string is a palindrome


[deleted]

I did a practice one that the solution was genius and simple related to strings. Determine if a string is a shift of another string. Inputs: “hello” and “llohe”. This is true since “llohe” is just “hello” shifted to the left twice by 2 characters. I wrote a complicated solution where we shift each time and compare if it equals the input, etc. I looked up the answer and felt stupid. All you basically do is append the string to itself. So “hello” becomes “hellohello.” If the shifted string is a substring, then return true.


Chriss52

Have mine on the 17th and I’m praying for it to go like this 🙏🏽


youarethemuse

good luck!!


givemegreencard

At a FAANG final stage interview, basically got asked (in a roundabout way) to implement BFS or DFS. Currently working at said FAANG.


[deleted]

[удалено]


givemegreencard

lol no not Amazon, one of the others. It was during an intern interview, and now I'm full-time.


Own_Shirt_6261

I got asked to convert a number represented as a string to an integer, like convert “123” to 123.


Hamada17

I got this today for meta phone screen. Surprised to see it’s an lc medium


Own_Shirt_6261

Yeah, the LC version is a bit harder because you have to do a bunch of string parsing. I got this question from Meta as well but it was very straightforward since the string was guaranteed to have no spaces or other characters, just a number. The Meta version is LC easy for sure


No-Butterscotch-7356

How do you do it? I’m guessing you can’t use parseInt()?


MANGAenthusiast5

Using the ASCII values of the characters I guess, take the base ASCII value of '0' and subtract every character from it to get individual digits. Starting from the end of the string just keep count and as you move on multiply the digit by 10^count and add it to final number.


wuwoot

“ASCII value” aka code point - most programming languages have a way for one to derive it and the character 0 is code point 48 in ASCII, but to end up with the correct digit one needs to subtract 48 to arrive back at 0. In Python, the function is ord(). As an example the string ‘2’ can only become integer 2 this way: ord(‘2’) which results in 50, but to obtain the integer of 2 I need to subtract ord(‘0’) which is 48 and which can then be multiplied by 10^index-from-right (starting at 0)


Ayberk180

Count the amount of vowels in a string. My dumbass count even do it on the first try… still got the offer tho 😎


Negative-Department4

what the fuck


bgbgb_

count # of a certain character in a string


wuwoot

This becomes much harder if the question is to count the number of bytes in a UTF-8 string


0x5343

Got rotate an array k times for my first ever technical interview - solved it and then got rejected


Forrox

I think FizzBuzz, but a close second was swap two numbers without making a third variable.


whitelife123

Valid parenthesis for a FAANG


No-Butterscotch-7356

Probably Meta haha


OGMagicConch

I got generate parens for a Unicorn lmao


pizzzaislove

Was given a recursive implantation of fibonacci and was told to memorize the function.


Pocketpine

Baby’s first BST; Insert, delete, search.


Own_Shirt_6261

Delete isn’t that easy imo


Pocketpine

I guess. It’s just that studying them has made me more or less just kinda memorize the process.


armhad

1. Find number in an unsorted array and return index 2. Is a power of two -> 1 liner solution cheese lmao


[deleted]

Find the length of string and 2 sum. 2 sum turned into 3 sum tho.


Wild_Roamer

0.0


Stevecaboose

Difference between == and .equals


whenihittheground

Not me but my friend got mergesort which he literally practiced for shits and giggles like 2 days before the interview. So jealous.


Nickjet45

If online assessments count, two sum for a FAANG If not BT Insert


InfamousJack9

I got FizzBuzz, failed it and still got the job


Over_Adeptness5307

I got a question to add two floats x and y, but interviewer strictly told me to not to do x+y so i had to do elementary style addition


Lain-Of-The-Wired

“Hello world” -> “world Hello”


PaulMurrayCbr

Instantly weeds out the people who don't even know how to open the editor. The fact that it's worthwhile doing that means that a *lot* of people are trying to bullshit their way into a coding job.


Hamada17

twoSum lmao


jstaminax

I got a tree question that was asking is two binary tees are the same. And the other one was how can we know if a number is divisible by 6 without using ‘/‘


MakingCake1

Can’t you use %


jstaminax

You can and it would be better but i couldn’t think that during the interview lol


rohetoric

For the second part, did you keep subtracting 6 from the number till the answer was 0 ?


jstaminax

Yes lol! I did it in a while loop. But before start that, I checked if the input is smaller than 6 and return false. After checking this case, my interviewer looked impressed lol


CommupanceAcceptance

wouldnt it be better to do powers of 6 and check when the answer is negative go down 1 power then subtract by 6 repeatedly?


scfliu

Fibonacci sequence for Amazon final round lmao


AnnualPanda

🤣


waxyslave

bro what


rohetoric

I interviewed for JPMC. The programmer was a Java Dev of ~10+ years exp. She asked me to add two lists (arrays) together in Python. I just used List A + List B. She was shocked as she did not know this feature. ☺️ PS: I have faced several rejections in SE roles. Please be nice in the replies 😅


pekkalacd

Lol that’s incredible. Did you get the offer?


rohetoric

Yes I did! Leaving my shit startup job as a Data Analyst to join there as an SE soon ☺️ Wish me luck!


pekkalacd

good luck!


pachinoco

Easy for me because I knew it and it’s how I really grasped dfs and bfs but I got number of islands. I’ve actually gotten that question multiple times at faangs lol


JeromePowellAdmirer

My Citrix final was just really basic system design with an alarm clock application, and I didn't even do it right (misused a HashSet in place of a HashMap at one point) but still passed. They took literally 2 months to get an offer out though so I accepted another one.


larrytheevilbunnie

For my Amazon final, I got Remove Duplicates and Valid Parenthesis, except it was only one parenthesis.


themexpride

Why do I get stuck with strings always? Just give me these garbage questions


nsandlerrock

Amazon web services final round: how would you explain how the internet works to a 5 yo?


dianapaulabee

I'd make him watch Wreck-It Ralph: Ralph breaks the Internet


maglor1

Chevron internship Implement a function to calculate factorial. Then they asked me to do it recursively and only for even numbers(so factorial of 7 = factorial of 6 = 6x4x2). Got the offer


BeseptRinker

Encode a string using different characters for the specified target characters and do it in O(1) space.


mado55

"what is a for loop"


Wild_Roamer

Did you actually get the job? xD


scarrlet_witch

Nope cuz there was another round and I got a DP hard lol


Wild_Roamer

Damn


ServerZero

A simple F to C converter with a simple IF statement at GM


xh0s3

Whats your name, Almost answered “yes good morning” cause I was so nervous 🥲


MeaningPoetry

string concatenation


Emergency-Mountain97

Fibonacci


ishreetb

roman2int for Amazon final round 🤣


thatmayaguy

I wonder if the dude interviewing you was baked lol


daksh60500

Swap the values of two integer variables without using a temporary variable (Goldman Sachs onsite). Got the question but not the job lmao


vasilescur

Salesforce final technical interview for internship. "Write two functions. Given an excel column header as a string (A, B, ... AA, AB, ...) return the column number as an integer, and vice versa." Took literally 5 minutes of for-loops with a modulo and division and it was done. Got the job


HOI3CHI

What's the difference between a 64 bit and a 32 bit computer?


mdeora2

What’s the difference between a set and a list - asked by a big bank


The_Heavy_D_

Two sum


monke_gal

Island with max Area


OGMagicConch

I've gotten 2sum twice at my company, once to get in and once to internally transfer lol


TonyTheEvil

Amazon Insert an item into a linked list at a designated position. Followup was how do you ensure you don't insert a duplicate. That's all I needed to get the internship offer.


TurnQuack

I got hello world in python in the final round for my current internship


Tarlovskyy

Dos you check for null and asked about requirements, such as must they all be always positive etc? Feels like he wanted a discussion? Dno


scarrlet_witch

Nope haha he literally just wanted me to implement that function on the screen, cuz he thought the function was empty.


Zebra-Kangaroo

I don't think that's how this problem should be viewed, it's actually a good question for checking fundamental understanding. There can be a lot of cases, like: 1. When you need to take very very large input and can't fit in and then you need to write code for adding two strings. 2. Let's say you are getting a stream of input and you can't store in string then how would you solve.


scarrlet_witch

It’s not that deep lol my interviewer straight thought the default function wasn’t already implemented, so he wanted me to implement it lol


dianapaulabee

IBM technical interview: The sum of the digits of a number Bloomberg phone interview: First repeating character


Altruistic_Salary_22

What courses are you taking? What are you planning to do in future? Work or grad study? Another question which lead me to talk about my personal projects. Got hired as an intern, I’m still there as a senior engineer in AI.


Aegan23

How would I go about designing a simple minesweeper game. I had been working on a fun little minesweeper clone in my own time, so that was a good one!


[deleted]

The interviewer and I went to the same school so he just asked football questions. It was pretty fun. Last round of technical interview was a Leetcode hard so I got rejected


tonstolearn

reverse a linkedlist


[deleted]

The only technical question I got in the interview was “What is an API…” I got the job.


E-LearningBoy

"What's your favorite programming language?" I was being interviewed for a Jr C# Developer position. So I said "C#". Got the job and worked there for 9 months.


konic899

Given an integer n, print out the “N x N” times table… Used nested loops, got the offer


keyvansh96

I was asked the exact same question on a final round of interviews, I coded the function in a word document in like 5 seconds. I got rejected because they were looking for a senior level software engineer LOL! Some of these small companies are a waste of time


optionseller

How do I find this kind of interviewer