Tech

Understanding MySQL Binary Logs

In the vast landscape of database management, MySQL’s binary log emerges as a silent guardian, recording the ebbs and flows of data modifications within the server. This indispensable component plays a pivotal role in tasks ranging from data replication to point-in-time recovery. In this exploration, we embark on a journey into the intricacies of MySQL…

Leetcode

1657. Determine if Two Strings Are Close

String closeness, in the context of this problem, involves evaluating whether two words can be considered “close” by meeting certain criteria. The criteria include having the same set of characters and the same frequency distribution of those characters. The closeStrings method endeavors to address this challenge. Unpacking the Solution Basic Check: The basicCheck method ensures…

Leetcode

237. Delete Node in a Linked List

The Singly-Linked List Conundrum Before delving into the intricacies of the Java solution, let’s understand the problem at hand. In a singly-linked list, each node contains a value and a reference to the next node in the sequence. The task is to delete a given node without access to the head of the linked list….

Java

How to initialise HashSet while declaring in Java

Before delving into initialization, let’s understand the allure of a HashSet. This data structure, based on the principles of a set in mathematics, provides rapid access to elements and ensures uniqueness—no duplicates allowed. Perfect for scenarios where order doesn’t matter, and you need swift membership checks. Techniques for Initializing HashSet During Declaration Method 1: Traditional…

Leetcode

1704. Determine if String Halves Are Alike

Problem: https://leetcode.com/problems/determine-if-string-halves-are-alike/description/ Breaking Down the Solution Converting String to Char Array: The input string s is converted into a character array a. This facilitates easy traversal and access to individual characters. Initialization and Set of Vowels: A HashSet vowels is created to store the vowels that need to be checked. The size of the array…

Leetcode

2385. Amount of Time for Binary Tree to Be Infected

Problem Statement: https://leetcode.com/problems/amount-of-time-for-binary-tree-to-be-infected/description/ Decoding the Algorithm: 1. Initialization and Connection Mapping: A HashMap (parentChildMap) is used to establish connections between child and parent nodes, essential for navigating the tree. The startNode is identified by traversing the tree until the desired node with the given value (start) is found. 2. Breadth-First Search (BFS): A LinkedList (queue)…

Leetcode

23. Merge k Sorted Lists

In the realm of algorithms and data structures, the task of merging k sorted linked lists is a familiar challenge. In this blog, we’ll embark on a journey through a naive approach and then pivot to a more optimal solution. Our starting point is a Java solution that might seem intuitive but lacks the efficiency…

Tech

A Guide to Linux Help Commands

Linux, with its powerful command-line interface, empowers users with a myriad of tools and utilities. Understanding how to navigate this vast ecosystem is crucial for efficient and effective system management. In this blog, we will explore key commands that provide invaluable help and documentation, namely whatis, man, –help, and apropos. 1. whatis – Unveiling the…

Pages