All Posts

Leetcode 19: Remove Nth Node From End of List

You are given the head of a singly linked list. Your task is to remove the nth node from the end of the list and return the updated list.

Leetcode 22: Generate Parentheses

Given a number ’n’, find all possible combinations of ’n’ pairs of parentheses that are balanced and well-formed.

Leetcode 24: Swap Nodes in Pairs

You are given the head of a singly linked list. Your task is to swap every two adjacent nodes in the list and return its head. The nodes themselves should be swapped, not just the values.

Leetcode 29: Divide Two Integers

Given two integers dividend and divisor, divide dividend by divisor without using multiplication, division, or modulus operators. Truncate the result towards zero and return the quotient.

Leetcode 31: Next Permutation

You are given an array of integers ’nums’. Find the next lexicographically greater permutation of the array. If no such permutation exists, return the smallest possible arrangement (sorted in ascending order). The result must be computed in place with no extra space.

Leetcode 33: Search in Rotated Sorted Array

You are given a sorted array ’nums’ which may have been rotated at an unknown pivot. Your task is to search for a target value in this rotated array. Return the index of the target if found, or -1 if not found. The solution must have a runtime complexity of O(log n).