-
Algorithms 101: Optimizing Longest Consecutive Sequence with Hash-Based Algorithm
•
Optimizing Longest Consecutive Sequence with Hash-Based Algorithm Finding the longest consecutive sequence in an array is a classic problem in computer science, often posed in technical interviews and algorithmic challenges. One efficient way to solve this problem is by using a hash-based algorithm that leverages hash sets for fast lookups.…
-
System Design 101: Large File Upload Design
•
Workflow for Large File Upload Design Initialize File Upload Session (File Creation Protocol) Client Action: The client starts by sending basic file metadata (e.g., filename, size) to the server. Server Response: The server returns a unique upload token that the client will use for all subsequent actions related to this…
-
LeetCode: 567 Permutation in String
•
LeetCode 567: Permutation in String Problem Description: Given two strings s1 and s2, write a function to check if s2 contains a permutation of s1. In other words, check if there exists a substring in s2 that is an anagram of s1. Code Implementation: from collections import Counter class Solution:…
-
Python 101: `defaultdict(set)`
•
defaultdict(set) is a special data structure from Python’s collections module that creates a dictionary with default values as sets. 1. Introduction to defaultdict defaultdict is a variant of a regular dictionary in Python, provided by the collections module. When you try to access a non-existent key, it won’t raise a…
-
Python 101: ‘str’ object has no attribute ‘sort’
•
The error 'str' object has no attribute 'sort' occurs when you try to call the sort() method on a string object in Python. The sort() method is designed for lists, not strings. Here’s how to fix this issue: Explanation Why it happens: In Python, strings are immutable sequences of characters…
-
System Design 101: Hash Function vs. Hash Table
•
Hash Function vs. Hash Table 1. Introduction In computer science, hash functions and hash tables are commonly used tools. A hash function is a mathematical function that generates a hash value, while a hash table is a data structure that uses hash functions to achieve efficient data access. Although closely…
-
LeetCode: 230 Kth Smallest Element in a BST
•
LeetCode 230: Kth Smallest Element in a BST https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Problem Description: Given the root of a binary search tree (BST), write a function to find the k-th smallest element in the tree. Example: Input: root = [3,1,4,null,2], k = 1 Output: 1 Input: root = [5,3,6,2,4,null,null,1], k = 3 Output:…
-
System Design 101: Checklist of Quality Attributes in Software Architecture
•
Checklist of Commonly Encountered Quality Attributes in Software Architecture When designing software systems, understanding and addressing quality attributes (also known as non-functional requirements) is crucial. These attributes ensure that the system not only meets functional requirements but also provides value through efficiency, reliability, security, and ease of use. Below is…
-
System Design 101: Levels of Architecture
•
Exploring Different Levels of Architecture: From Enterprise to Application Architecture is a critical component in managing complexity, defining scope, and aligning strategic goals in any organization. It provides a structured approach to aligning business strategy with the right technology solutions. In this blog, we will explore three key types of…
-
JavaScript 101: JavaScript Proxy
•
Why Use JavaScript Proxy? The Proxy feature in JavaScript is a powerful and flexible tool that allows developers to create a proxy object, which can intercept and customize fundamental operations for a target object. Essentially, a Proxy acts as a layer between the real object and any operations that are…