Madhav ⚡️

1.2K posts

Madhav ⚡️ banner
Madhav ⚡️

Madhav ⚡️

@askmaddyy

Engineer | @Amazon | @AmericanExpress | PEC - 22

Bengaluru, India Katılım Temmuz 2025
168 Takip Edilen1.1K Takipçiler
Sabitlenmiş Tweet
Madhav ⚡️
Madhav ⚡️@askmaddyy·
You're in a noisy cafe, a banger comes on, you pull out your phone, and BAM. @Shazam names the song in 5 seconds. How is this even possible?! It’s not magic. It’s one of the most brilliant pieces of engineering in your pocket. A thread on how Shazam really works 🧠🎶👇
Madhav ⚡️ tweet media
English
4
2
33
4.5K
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Sick of seeing fake AI interview questions on the timeline. I’ll post one real question every day. Stuff I’ve actually seen in interviews. Day 3: You are given a sorted array that has been rotated an unknown number of times. Find the minimum element. Example: [4, 5, 6, 7, 0, 1, 2] → 0 How would you approach this?
English
2
1
2
22
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Hint: The array is still partially sorted. Use that.
English
0
0
2
9
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@PythonPr Ans: 6 When we start processing X as it contains numerical operators (+ and *) the value true and false are converted to the numerical equivalent of them. True becomes 1, false becomes 0. Now the calculation is simple X = 1+ 1*2 => 1+2 => 3 Y = 0+3 => 3 X+Y = 6
English
0
0
3
122
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@EOEboh 12 rows. Cross join creates a cartesian product, every row in A pairs with every row in B (3 × 4 = 12).
English
0
0
1
470
Captain-EO 👨🏾‍💻
How many rows does this return? Table A: 3 rows Table B: 4 rows SELECT * FROM A CROSS JOIN B
English
7
0
21
9.6K
Madhav ⚡️
Madhav ⚡️@askmaddyy·
This is a common bug, so the idea is each server pulls the count from DB, calculates the final count (by adding the page views it stored locally) and updates the DB with that final count, would've worked absolutely fine if we had a single server. Here we are losing the counts from other servers. Ideally it should just send an update query to add the page views on the server and let DB handle concurrency.
English
0
0
2
315
Abhishek Singh
Abhishek Singh@0xlelouch_·
You're implementing a distributed counter (total page views) across 100 servers. Each server increments locally and syncs to database every 10 seconds, but the count is always incorrect. What's the bug? [Topic: Distributed Counters]
English
6
0
39
5.6K
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@ashoKumar89 Indexes slow writes in high traffic systems, every insert, update and delete query has to update B-trees. Better approach is to check and update existing indexes, caching, or read replicas first.
English
0
0
5
205
Ashok Sahoo
Ashok Sahoo@ashoKumar89·
A senior dev proposes: “Add more indexes- queries are slow.” But write traffic is very high. What is your concern?
English
9
1
30
8.6K
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@imukulmunjal Interesting direction, can you explain more about this approach because I see a small bug with this approach where it might not be able to catch duplicates
English
0
0
1
13
Mukul building InterviewFlowAI
@askmaddyy bloom filter pass to flag candidates, then external sort + merge for confirmation. classic constraint problem. love this series
English
1
0
0
22
Madhav ⚡️ retweetledi
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Sick of seeing fake AI interview questions on the timeline. I’ll post one real question every day. Stuff I’ve actually seen in interviews. Day 2: This one was asked to me in an internship interview back in college. You have 1 billion integers. You need to find duplicates. You can’t load everything into memory. What would you do?
English
2
1
4
123
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Hint: If it doesn’t fit in memory, think about splitting the data and working on smaller parts.
English
0
1
5
61
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@PythonPr The answer is 20, t[1] points to the 2nd element in the list which in this case is 10. We just multiply it by 2 and get our answer.
English
0
1
6
846
Madhav ⚡️ retweetledi
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Could be questions I’ve asked candidates or ones I’ve been asked
English
1
1
2
47
Madhav ⚡️ retweetledi
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Everyone on X are posting fake interview questions lately. Should I start posting the real interview questions starting tomorrow?👀
English
3
1
4
99
Hacktivist
Hacktivist@hackt1v1st·
@askmaddyy AI resource cost is coming to bite these orgs? 👀
English
1
0
0
10
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@PythonPr Took me a good 2 mins to understand but we’re using uppercase ‘P’ for print in the second part of the image, python is case sensitive so it should be ‘print’ not ‘Print’
English
0
0
5
341
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@hackt1v1st That’s the correct approach, one minor change would be to simultaneously update lower bound as you jump ahead. But the solution you gave earlier was clever and would’ve worked if we had unique integers. Nice work!
English
0
0
3
12
Hacktivist
Hacktivist@hackt1v1st·
@askmaddyy But then again, it'll only apply in sorted and also unique... So rather than jumping my mid, should I jump my high index till I get an element greater than target, in the exact manner? And from there I get my upper bound to apply BS...
English
1
0
1
16
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Sick of seeing fake AI interview questions on the timeline. I’ll post one real question every day. Stuff I’ve actually seen in interviews. Day 1: You are given a sorted infinite stream of integers. You cannot get its length, but you can access elements at an index i using get(i). How will you find the position of a given number?
English
3
1
9
284