Skip to content

Instantly share code, notes, and snippets.

View aditi5's full-sized avatar

Aditi Mishra aditi5

View GitHub Profile
@aditi5
aditi5 / flows
Last active March 24, 2025 04:49
1. https://claude.site/artifacts/cd4083fe-8e3d-4ac1-9cfa-44a0825fa7a4
2. https://claude.site/artifacts/7476bd34-d035-4bea-82e5-9d99934dd31a
3. https://claude.site/artifacts/fbc8e46d-4e2f-4e66-829b-e01c12bebc87
4. https://claude.site/artifacts/487436dc-70f5-495e-9525-68708a65886b
5. https://claude.site/artifacts/19f33855-c94b-4427-a6a4-f880d96794e5
6. https://claude.site/artifacts/8dc664b0-68ff-4024-92e7-a3095063f436
7. https://claude.site/artifacts/416d2cf7-5490-4f7e-bea7-33ca878678dd
8. https://claude.site/artifacts/17c84c80-29da-42ef-b3e2-447b58440d66 - Gojek flow allocations
9. https://claude.site/artifacts/64b30215-c785-4f2f-8f61-e6fc4a3fe2d3 - LLD checklist
We couldn’t find that file to show.
Problem Statement
1 You have a stream of events where each event represents a page visit or any other kind of activity. Each event has a timestamp associated with it. You need to design a system that can efficiently track and report the top K most visited pages (or most frequent elements) over different time windows: the last 1 hour, last 1 day, and last 1 week.
```python
import heapq
from collections import deque, defaultdict
from datetime import datetime, timedelta
@aditi5
aditi5 / heap
Last active August 19, 2024 12:35
1. https://leetcode.com/problems/word-ladder/description/
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/zsNcuYy1AJkMFjubPJhVXUXltI7rMJ3D/vj595y8l6.png)
```python
import heapq
import string
class Solution:
@aditi5
aditi5 / mylist 2
Last active August 13, 2024 13:26
29 https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/gp8UBAnnYZn2KE47OI9Jva7lP1FGhqpL/igoqziydw.png)
```python
class Solution:
def __init__(self):
self.mp = {
1. https://leetcode.com/problems/maximum-profit-from-trading-stocks/description/
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/ioSnhLPnu5817kBOGHAaw9sdQnirz0dn/rj7u287hp.png)
```from typing import List
class Solution:
def maxProfitHelper(self, i: int, budget: int, present: List[int], future: List[int], memo) -> int:
# Base case: If we've gone through all stocks or the budget is 0
1 https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/w2H9SWR5cSkBDdxH_YN1zo0pG9fKIuEa/qtaztkk9c.png)
```
class Solution:
def maxProfit(self, prices: List[int]) -> int:
minPrice = float('inf') # minimum price seen so far
maxProfit = 0 # maximum profit that can be achieved
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/49QLBhIlMWNRp_UGE2q1h80TR7Aj6tOU/sy71bi8gl.png)
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/Rpmw0U5nUfxuG7NMSvUvefuDuLqlDJfr/bbuse1rj3.png)
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/vGTcijes6_1uLKZWJQ60c22VzTibCN9J/x49m92u3t.png)
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/ogGm1iosWR4iCuT1Ot6lZyZD6Y9h0Zuw/f9mjrtlj0.png)
1 https://leetcode.com/problems/minimum-window-substring/description/
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/viqGYj3F1Rl7ewEzUIM6WSasbENHLMse/knzowmkgj.png)
```python
class Solution:
def minWindow(self, s, t):
# Importing defaultdict for more efficient counting
![](https://cdn.cacher.io/attachments/u/3b3qij9sue2rm/bYScg8FY8N-a3WO610YQo9tP2h5vV5ph/po6e1ic8a.png)