Day 60👾:
Given an arrayarr[]
of non-negative integers, where each elementarr[i]
represents the height of the vertical lines, find the maximum amount of water that can be contained between any two lines, together with thex-axis
.
Note: In the case of a single vertical line it will not be able to hold water.
👍3🔥1🥰1👏1
Day 61👾:
Given an array of integersarr[]
, the task is to find the first equilibrium point in the array.
The equilibrium point in an array is an index (0-based indexing
) such that the sum of all elements before that index is the same as the sum of elements after it.Return -1
if no such point exists.
❤2👏2👍1🔥1
🔥2❤1👍1
Day 69👾:
Given the head of two singly linked listsnum1
andnum2
representing two non-negative integers. The task is to return the head of the linked list representing the sum of these two numbers.
For example,num1
represented by the linked list :1 -> 9 -> 0
, similarlynum2
represented by the linked list:2 -> 5
. Sum of these two numbers is represented by2 -> 1 -> 5
.
Note: There can be leading zeros in the input lists, but there should not be any leading zeros in the output list.
🔥3👍1🍾1👨💻1
Day 70👾:
You are given a special linked list with n nodes where each node has two pointers a next pointer that points to the next node of the singly linked list, and a random pointer that points to the random node of the linked list.
Construct a copy of this linked list. The copy should consist of the same number of new nodes, where each new node has the value corresponding to its original node. Both the next and random pointer of the new nodes should point to new nodes in the copied list, such that it also represent the same list state. None of the pointers in the new list should point to nodes in the original list.
Return the head of the copied linked list.
NOTE : Original linked list should remain unchanged.
🔥2👏2❤1👍1
Day 72👾:
Given a head of the singly linked list. If a loop is present in the list then return thefirst node
of the loop else returnNULL
.
Custom Input format:
A head of a singly linked list and a pos (1-based index
) which denotes the position of the node to which the last node points to. Ifpos = 0
, it means the last node points to null, indicating there is no loop.
👍2🔥2⚡1👏1
Day 73👾:
Given the head of a linked list that may contain a loop. A loop means that the last node of the linked list is connected back to a node in the same list. The task is to remove the loop from the linked list (if it exists).
Custom Input format:
A head of a singly linked list and a pos (1-based index) which denotes the position of the node to which the last node points to. If pos = 0, it means the last node points to null, indicating there is no loop.
The generated output will be true if there is no loop in list and other nodes in the list remain unchanged, otherwise, false.
👍4🔥1👏1