So, question from real prod investigation.
You are high load system, and you are checking metrics of where server sends requests to.
You see 99% of destination ports reported by some low level tool (bpf) equal to 47873.
Apparently this is not usual port, as most of the IPs are leading to cloud providers, eg azure, aws, etc.
What is the actual port?
Hint: small/big endian.
(Posting real answer with explanation in the evening)
You are high load system, and you are checking metrics of where server sends requests to.
You see 99% of destination ports reported by some low level tool (bpf) equal to 47873.
Apparently this is not usual port, as most of the IPs are leading to cloud providers, eg azure, aws, etc.
What is the actual port?
Hint: small/big endian.
(Posting real answer with explanation in the evening)
π₯6
β€3
Daily (258/373 streak until LC cap)
Regular easy problem, practicing more intuition building than any pattern
https://leetcode.com/problems/furthest-point-from-origin/?envType=daily-question&envId=2026-04-25
#daily #easy
Regular easy problem, practicing more intuition building than any pattern
https://leetcode.com/problems/furthest-point-from-origin/?envType=daily-question&envId=2026-04-25
#daily #easy
β€2
andreyka26_se
So, question from real prod investigation. You are high load system, and you are checking metrics of where server sends requests to. You see 99% of destination ports reported by some low level tool (bpf) equal to 47873. Apparently this is not usual portβ¦
The correct answer is 443.
Now explanation. On the low level (BPF) you might have two different bytes order (not bits order though) for number that include ips and ports: big-endian and small-endian. The problem was that some tool assumed wrong endian for port and did reversing of the bytes, however the underlying library was already giving the port in the correct number
Now explanation. On the low level (BPF) you might have two different bytes order (not bits order though) for number that include ips and ports: big-endian and small-endian. The problem was that some tool assumed wrong endian for port and did reversing of the bytes, however the underlying library was already giving the port in the correct number
π5
Daily (259/373 streak until LC cap)
I mean whenever I see "maximum possible minimum" and hard badge, it is skip, I"m sorry. Took me too much to even understand the problem statement, and today was socializing day I don't even have energy to solve hard nonsense right now.
https://leetcode.com/problems/maximize-the-distance-between-points-on-a-square/description/?envType=daily-question&envId=2026-04-25
#daily #hard
I mean whenever I see "maximum possible minimum" and hard badge, it is skip, I"m sorry. Took me too much to even understand the problem statement, and today was socializing day I don't even have energy to solve hard nonsense right now.
https://leetcode.com/problems/maximize-the-distance-between-points-on-a-square/description/?envType=daily-question&envId=2026-04-25
#daily #hard
β€6
Daily (260/373 streak until LC cap)
Amazing problem, really recommended, it if first of all not bullshit, it has well known pattern, well known algo in computer science, I personally was asked to implement similar in one of my interviews to big tech
https://leetcode.com/problems/detect-cycles-in-2d-grid/description/?envType=daily-question&envId=2026-04-26
#daily #medium #pattern #recommend
Amazing problem, really recommended, it if first of all not bullshit, it has well known pattern, well known algo in computer science, I personally was asked to implement similar in one of my interviews to big tech
https://leetcode.com/problems/detect-cycles-in-2d-grid/description/?envType=daily-question&envId=2026-04-26
#daily #medium #pattern #recommend
LeetCode
Detect Cycles in 2D Grid - LeetCode
Can you solve this real interview question? Detect Cycles in 2D Grid - Given a 2D array of characters grid of size m x n, you need to find if there exists any cycle consisting of the same value in grid.
A cycle is a path of length 4 or more in the grid thatβ¦
A cycle is a path of length 4 or more in the grid thatβ¦
π4
This media is not supported in your browser
VIEW IN TELEGRAM
This guyβs really fighting with itπ
π4β€2
Daily (261/373 streak until LC cap)
Amazing graph problem. Definitely recommended, it is not that frequent to have a good problem on daily (I have put thumb up)
https://leetcode.com/problems/check-if-there-is-a-valid-path-in-a-grid/description/?envType=daily-question&envId=2026-04-27
#daily #medium #pattern #recommend
Amazing graph problem. Definitely recommended, it is not that frequent to have a good problem on daily (I have put thumb up)
https://leetcode.com/problems/check-if-there-is-a-valid-path-in-a-grid/description/?envType=daily-question&envId=2026-04-27
#daily #medium #pattern #recommend
β€3π2
Daily (262/373 streak until LC cap)
Funny, I has solved this problem 26th of March last year.
Not bad daily, however I don't see any pattern except some simple math and intuition.
https://leetcode.com/problems/minimum-operations-to-make-a-uni-value-grid/submissions/?envType=daily-question&envId=2026-04-28
#daily #medium #nopattern
Funny, I has solved this problem 26th of March last year.
Not bad daily, however I don't see any pattern except some simple math and intuition.
https://leetcode.com/problems/minimum-operations-to-make-a-uni-value-grid/submissions/?envType=daily-question&envId=2026-04-28
#daily #medium #nopattern
π3
I have decided. Next article is going to be Uber system design or Load balancers / proxies deep dive.
Dont worry, I am not switched to leetcode posting only, jut having hard time at snowflake at the moment.
Dont worry, I am not switched to leetcode posting only, jut having hard time at snowflake at the moment.
π15π₯3β€1
Daily (264/373 streak until LC cap)
Nice reminder for Dynamic Programming, not hard to be honest.
https://leetcode.com/problems/maximum-path-score-in-a-grid/description/?envType=daily-question&envId=2026-04-30
btw, yesterday's daily was a bit bullshit and hard, so skipping.
#daily #medium #pattern
Nice reminder for Dynamic Programming, not hard to be honest.
https://leetcode.com/problems/maximum-path-score-in-a-grid/description/?envType=daily-question&envId=2026-04-30
btw, yesterday's daily was a bit bullshit and hard, so skipping.
#daily #medium #pattern
β€4
Daily (265/373 streak until LC cap)
Purely math problem if you'd like to do it.
The challenge here is only to come up with smart formula.
https://leetcode.com/problems/rotate-function/description/?envType=daily-question&envId=2026-05-01
#daily #medium
Purely math problem if you'd like to do it.
The challenge here is only to come up with smart formula.
https://leetcode.com/problems/rotate-function/description/?envType=daily-question&envId=2026-05-01
#daily #medium
π3
NAT GATEWAY.
Sharing some real production learning. I was never using cloud properly as I never had to. Yesterday I needed to understand how AWS NAT GW works, and it was quite surprising.
How (in general) NAT GW works.
Client (or private server) from private network (let's say LAN, or cloud provider's private virtual network) WANTS to talk to internet.
Since client has private IP, if it directly sends the request to the destination, routers will drop it according to protocols they are using, as they need public source ip.
So what typically is done, e.g. in simple case of your home internet, you have wifi router, that serves as NAT GW and replaces your private ip to its public ip (SNAT - Source NAT). That way packet can be routed to destination
On the way back (response) NAT GW receives the packet, as it had the source public IP of initial request, performs DNAT (Destination NAT) and replaces destination to be the private client.
continuation in the next post ...
#network
Sharing some real production learning. I was never using cloud properly as I never had to. Yesterday I needed to understand how AWS NAT GW works, and it was quite surprising.
How (in general) NAT GW works.
Client (or private server) from private network (let's say LAN, or cloud provider's private virtual network) WANTS to talk to internet.
Since client has private IP, if it directly sends the request to the destination, routers will drop it according to protocols they are using, as they need public source ip.
So what typically is done, e.g. in simple case of your home internet, you have wifi router, that serves as NAT GW and replaces your private ip to its public ip (SNAT - Source NAT). That way packet can be routed to destination
On the way back (response) NAT GW receives the packet, as it had the source public IP of initial request, performs DNAT (Destination NAT) and replaces destination to be the private client.
continuation in the next post ...
#network
β€3
Generally, if I am using NAT GW in some cloud provider and want to check the logs here, what I expect to see?
I would expect to see the logs for request out (egress):
- entry 1: ec2 -> natgw, so private ip of ec2 and private ip of NAT GW.
- entry 2: natgw -> internet, so PUBLIC ip of nat gw and PUBLIC IP of internet.
However this is not how it works guys.
===
You will never see public ip of the NAT GW in flow logs in aws, because NAT GW private IP -> NAT GW public IP translation happens on IGW instance (which is also NAT in nature). What NAT GW will do is just perform SNAT from ec2 private ip to NAT's private ip.
Another learning, flow logs can be attached to different instances, and ini case this is ENI, you should understand how to analyze it properly. For example response from internet to ec2 would typically mean "ingress" as it comes FROM internat TO our private network, BUT on ENI level, the leg NAT GW -> EC2 resopnse is EGRESS, because it is coming out of NAT GW ENI to EC2.
#network #cloud
I would expect to see the logs for request out (egress):
- entry 1: ec2 -> natgw, so private ip of ec2 and private ip of NAT GW.
- entry 2: natgw -> internet, so PUBLIC ip of nat gw and PUBLIC IP of internet.
However this is not how it works guys.
===
You will never see public ip of the NAT GW in flow logs in aws, because NAT GW private IP -> NAT GW public IP translation happens on IGW instance (which is also NAT in nature). What NAT GW will do is just perform SNAT from ec2 private ip to NAT's private ip.
Another learning, flow logs can be attached to different instances, and ini case this is ENI, you should understand how to analyze it properly. For example response from internet to ec2 would typically mean "ingress" as it comes FROM internat TO our private network, BUT on ENI level, the leg NAT GW -> EC2 resopnse is EGRESS, because it is coming out of NAT GW ENI to EC2.
#network #cloud
π₯4β€1