Shivam TyagiOptimally find length of a loop in linked list in JavaTo find the length of the loop in a linked list, we first need to detect the loop using Floyd’s Cycle Detection Algorithm (also known as…20h ago20h ago
Shivam TyagiLL#6 Remove N-th node from back of LinkedList in java simple and optimalTo remove the N-th node from the end of a linked list in a simple and optimal way, you can use the two-pointer technique (also known as the…1d ago1d ago
Shivam TyagiDelete a given Node when a node is given.(0(1) solution)To delete a given node in a singly linked list in constant time O(1), you can use a clever trick. Normally, deleting a node in a linked…1d ago1d ago
Shivam TyagiIntersection of two singly linked lists in a simple and optimal way in JavaTo find the intersection of two singly linked lists in a simple and optimal way, you can use the following approach. The key idea is to…2d ago2d ago
Shivam TyagiMerge two sorted linked lists simple and optimal way in JavaMerging two sorted linked lists is a common problem that can be solved efficiently. Here’s how you can do it in a simple and optimal way…3d ago3d ago
Shivam TyagiUses of @spy annotation in JUnit TestingThe @Spy annotation in JUnit, particularly when used with Mockito, is applied to create a spy on an actual object. A spy is a partial mock…3d ago3d ago
Shivam TyagiHow to check If a Linked List Is Palindrome optimally and simply in JavaTo check if a singly linked list is a palindrome optimally and simply in Java, you can follow these steps:Aug 8Aug 8
Shivam TyagiHow to reverse a linked list in simple and optimal way in javaTo reverse a linked list in Java, you can use an iterative approach which is both simple and optimal in terms of time complexity O(n) and…Aug 7Aug 7
Shivam TyagiCycle Detection in a Singly Linked List in simple and optimal wayDetecting a cycle in a singly linked list can be efficiently done using Floyd’s Cycle-Finding Algorithm, also known as the “Tortoise and…Aug 7Aug 7