Remove more than two duplicates in-place
Problem Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array nums. More formally, if there are k elements after removing the duplicates, then the first k elements of nums should hold the final result....
Inplace element removal an easy one
Problem Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val. Consider the number of elements in nums which are not equal to val be k, to get accepted, you need to do the following things: Change the array nums such that the first k elements of nums contain the elements which are not equal to val....
The nicest way to merge two sorted arrays
You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order. The final sorted array should not be returned by the function, but instead be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored....
gRPC - The Witchcraft of Remote Procedure Calls
WTF is gRPC? Why GRPC ? Some technologies are like witchcraft. You hear about them, you see them in action, but you donโt really understand how they work. gRPC is one of those technologies for me. Itโs a remote procedure call (RPC) framework that allows you to define services and methods in a language-agnostic way, and then generate client and server code in multiple languages. So what it means is there is a ....
Replication - Leaders and Followers
Replication - Leaders and Followers Replication, or read replica is a process of copy pasting data from a primary database to another database. This is done to improve performance, availability, and reliability of the database. Replication can be done in two ways: synchronous and asynchronous. In synchronous replication, the primary database waits for the replica to acknowledge that it has received the data before it can proceed. This ensures that the data is always consistent between the primary and replica databases, but it can also slow down the performance of the primary database....
IP V4 Subnetting tricks and basics
IP V4 Subnetting tricks and basics Introduction As usual lets try to be little intellectual. By saying a qoute i got it from chatgpt. โGood subnetting is like good carpentry: measure twice, cut once.โ What ever it means it doesnt matter. But the point is to understand the concept of subnetting and how it works. This is somehow one of the most mind f**k*ng topic which i encoutered during my job....
Enterprise Over Engineering
The Hidden Pitfalls of Overusing Design Patterns This is my story of using the Chain of Responsibility pattern after reading about it in a book while preparing for an interview. Yes โ I actually used it in a real job. And well, it didnโt turn out the way I had imagined. Before we dive in, hereโs a quote from one of my favorite authors, Khaled Hosseini (The Kite Runner): โThere is only one sin, only one....
เดฎเดงเตเดฐเด เดฎเดฒเดฏเดพเดณเด. เดเดฐเต เดฎเดฒเดฏเดพเดณเด เดชเตเดฐเตเดฌเตเดฒเด เดธเตเตพเดตเดฟเดเต
เดเดจเดฟเดเตเดเต เดชเดฒเดชเตเดชเตเดดเตเด เดคเตเดจเตเดจเดฟเดฏเดฟเดเตเดเตเดฃเตเดเต เดจเดฎเตเดฎเตเดเต เดเดคเต เดญเดพเดทเดฏเดฟเดฒเดพเดฃเต เดจเดฎเตเดฎเดณเตเดเต เดฌเตเดฐเตเดฏเดฟเตป เดชเตเดฐเดตเตผเดคเตเดคเดฟเดเตเดเตเดจเตเดจเดคเต เดเดจเตเดจเต. เดเดจเตเดฑเตผเดจเตเดฑเตเดฑเดฟเตฝ เดชเดฐเดคเตเดฎเตเดชเตเตพ เดจเดฎเตเดฎเตเดเตเดเต เดฎเดจเดธเดฟเดฒเดพเดเตเด เดฌเตเดฐเตเดฏเดฟเตป symbols เดเด เดฎเตเดกเดฒเตเดเดณเตเด เดเดฃเต เดเดชเดฏเตเดเดฟเดเตเดเตเดจเตเดจเดคเต เดเดจเตเดจเต.ย เดชเดเตเดทเต เดเดฐเต เดชเตเดฐเตเดฌเตเดฒเด เดธเตเตพเดตเต เดเตเดฏเตเดฏเตเดฎเตเดชเตเตพ เดจเดฎเตเดฎเตเดเต เดฌเตเดฐเตเดฏเดฟเตป เดเตเดเตเดคเตฝ เดธเดฎเดฏเดตเตเด เดเดฟเดฒเดตเดดเดฟเดเตเดเตเดจเตเดจเดคเต เดเดกเดฟเดฏเดเดณเต เดชเดฐเดฟเดญเดพเดท เดเตเดฏเตเดฏเดพเตป เดเดฏเดฟเดฐเดฟเดเตเดเตเด. เดชเตเดฐเดคเตเดฏเตเดเดฟเดเตเดเต เดฎเดฒเดฏเดพเดณเดพเดฏเดฟ เดเดฏ เดเดจเดฟเดเตเดเต เดเดคเตเดฐเต เดชเตเดฐเดถเตเดจเดฎเดพเดฏเดฟ เดคเตเดจเตเดจเดฟเดฏเดฟเดเตเดเตเดฃเต. เดเดฟเดฒ เดชเตเดฐเตเดฌเตเดฒเตเดเดธเต เดธเตเตพเดตเต เดเตเดฏเตเดฏเตเดฎเตเดชเตเตพ เดเดจเดฟเดเตเดเต เดเตเดเตเดคเตฝ เดตเดดเดเตเดเตเดจเตเดจ เดญเดพเดท เด เดคเต เดฎเดฒเดฏเดพเดณเด เดเดฃเต. เดเดฆเดพเดนเดฐเดฃเดคเตเดคเดฟเดจเต เด เดชเตเดฐเตเดฌเตเดฒเด เดจเตเดเตเดเต. Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining....
Managing Concurrent Updates with Distributed Locks
Managing Concurrent Updates with Distributed Locks Managing Concurrent Updates with Distributed Locks In distributed systems, managing concurrent access to shared resources is crucial to ensure data consistency and prevent corruption. Letโs explore how to handle this using a Java example, starting with a basic implementation and improving it step-by-step. Basic Implementation Without Proper Lock Handling Hereโs a simple version of a method that tries to acquire a distributed lock, perform an update, and release the lock:...
Revisiting Dynamic Programming
The main problem with me w.r.t DP problem is forgetting it if i don't practice. So I decided to revisit all the DP problems i solved once again just to refresh my memory. So first Lets start with a simple one. Here we go!!! Climbing stairs from Leetcode. Explanation : You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps....