Madhav ⚡️

1.2K posts

Madhav ⚡️ banner
Madhav ⚡️

Madhav ⚡️

@askmaddyy

Engineer | @Amazon | @AmericanExpress | PEC - 22

Bengaluru, India Beigetreten Temmuz 2025
168 Folgt1.1K Follower
Angehefteter 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·
Earlier one server was doing all the work, whatever data it needed it would make a call to internal methods but now we have carved out services out of that monolith. To get the same data servers call another server adding network latency. To handle these complex structures we might introduce more steps so the system is resilient but those extra steps mean extra computation hence extra time. Also there is the issue if let’s say we have the same DB being accessed by multiple instances of the service and one instance might not be able to get the connection to DB that too adds to the overall response being slow.
English
0
1
2
117
Javarevisited
Javarevisited@javarevisited·
Interviewer: Why does adding more servers sometimes make a system slower?
English
8
0
11
2.9K
Madhav ⚡️
Madhav ⚡️@askmaddyy·
@danish__an Good going, the beauty of the problem is how you shrink the search space.
English
0
0
2
6
Danish 𝕩
Danish 𝕩@danish__an·
@askmaddyy I will make implement binary search with little modification, will return only when mid index is greater than mid + 1 or mid - 1 is also greater then mid then return mid - 1 and if both the condition isn't satisfied then will reduce the searching space by adding..
English
1
0
0
15
Madhav ⚡️ retweetet
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
4
178
Danish 𝕩
Danish 𝕩@danish__an·
@askmaddyy In this question first I will try to find the pivot element the condition to get the pivot would be if Previous number is greater and next number is also greater if both condition satisfied then that is the minimum element in the array...
English
1
0
0
22
Madhav ⚡️
Madhav ⚡️@askmaddyy·
Hint: The array is still partially sorted. Use that.
English
0
0
2
28
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
9
1.1K
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
616
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
28
14K
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
367
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
7
0
44
6.5K
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
237
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
10
1
33
9.7K
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
15
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 ⚡️ retweetet
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
136
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
63
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
874