The reorderList function will return the head of the reordered linked list given a linked list as input

Reorder Linked Lists

Implement a reorderList function that takes the head of a linked list (node(0) -> node(1) -> node(2) -> .. -> node(n-1) -> node(n)) as input and reorders its nodes in the form node(0) -> node(n) -> node(1) -> node(n-1) -> node(2) -> .. .

February 15, 2024 · 9 min · Avnish
The mergeTwoLists function will return the head of the merged linked list given two sorted linked lists as input

Merge Two Sorted Linked Lists

Implement a mergeTwoLists function that takes the head nodes of two sorted linked lists as the input and returns the head of the merged linked list

January 29, 2024 · 4 min · Avnish
The reverseList function will return the head of the reversed linked list

Reversing Linked Lists

Implement a reverseList function that takes the head of a linked list as the input and returns the head of the reversed linked list

January 26, 2024 · 4 min · Avnish
We can improve the time complexity of some solutions from quadratic to linear using the two-pointer approach

Two-Pointer Approach

The two-pointer approach provides an efficient alternative for solving problems related to substrings, subarrays, and sequences.

January 23, 2024 · 7 min · Avnish
Linked Lists

Linked Lists

A Linked List uses dynamic allocation of memory to store sequential data

November 17, 2023 · 13 min · Avnish
The longestConsecutive function will return the length of the longest sequence if consecutive numbers in the input array

Finding the Longest Consecutive Sequence in an Array

Implement a longestConsecutive function that returns the length of the longest sequence of consecutive numbers in an array

November 9, 2023 · 6 min · Avnish
The encode function will encode a list of strings to a single string while the decode function will take the encoded string and return the original list of strings as output

Encoding and Decoding Functions for Strings

Implement an encode function to encode a list of string values to be transmitted over a network. Also, implement a decode function to convert the encoded string back to its original value.

November 6, 2023 · 8 min · Avnish
The isValidSudoku function will return true if the input matrix represents a valid sudoku grid and false otherwise

Checking the Validity of a Sudoku Grid

Implementing an isValidSudoku function that takes a matrix representing a Sudoku grid as inputs and returns true if it is valid and false otherwise

November 2, 2023 · 12 min · Avnish
The productExceptSelf function will returns an array of products of all the elements without the element at the same index in input array

Building a Product Array without the Element Itself

Implementing a productExceptSelf function that returns an array of products of all the elements without the element at the same index in input array

October 28, 2023 · 5 min · Avnish
The topkFrequent function will return the top k most frequent elements in an array

Finding Most Frequent Elements in an Array

Implementing a topKFrequent(nums, k) function that takes an array of integers and a value k as inputs and returns top k most frequent elements.

October 26, 2023 · 7 min · Avnish