The two separate list, merge them to create a new list. Example: Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4 The solution as expected is very simple. In this tutorial we shall look at 2 different solutions: Iterative Method Recursion Method For both the solution the concept …
Problem Statement: Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator. Return the quotient after dividing dividend by divisor. Example 1: Input: dividend = 10, divisor = 3 Output: 3 Both dividend and divisor will be 32-bit signed integers. The divisor will …
Problem description: Given a linked list, remove the n-th node from the end of the list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. We shall solve this problem …
Problem Explanation: Given a linked list, swap every two adjacent nodes and return its head. Example: Given 1->2->3->4, you should return the list as 2->1->4->3. We can solve the above problem with 2 solutions. Iterative Recursive According to the problem we need to solve it using constant …