-
Tuya + HomeKit Integration with Python + Raspberry Pi
You can access the code here. In this project, I build a simple script that is used to control Tuya lightbulbs/switches from the Apple Home app. Currently, it only offers on/off functionality. I wanted to keep this as bare minimum as possible, but you can modify the code as you see fit for your use […]
-
LeetCode 763. Partition Labels Solved (Greedy Method)
The prompt for this problem was honestly kind of confusing. But, what I was able to understand was that we want to maximize the number of partitions we can make, but a letter can only appear in one partition. So for example, if we partition the string into two halves, both halves cannot have the […]
-
LeetCode 1899. Merge Triplets to Form Target Triplet Solved (Greedy Method)
A lot of times with Greedy problems the answer can be very tricky, however with this problem, the answer is pretty intuitive and it’s easy to see that the brute force approach which would potentially be a backtracking approach would be a lot of work, and the time complexity would also be exponential. Using the […]
-
63. Unique Paths II Solved (Dynamic Programming)
This problem is relatively easy after solving the Unique Paths I problem, it just builds on the same problem by now adding obstacles to the grid. So I had to change the approach a bit. For the recursive approach, it was a matter of just adding more constraints. So, if the index was an index […]
-
LeetCode 309. Best Time to Buy and Sell Stock with Cooldown (Dynamic Programming)
The first step in understanding this problem is understanding the decisions we can make based on the option we have, which will allow us to form a decision tree. So, starting from index 0 we have the option to buy the stock at index/day 0 or just wait and go to the next day. If […]