Home
Gaurav's GitHub Page
Cancel

N-Queens

Problem Description The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to t...

Next Greater Element IV

Problem Description You are given a 0-indexed array of non-negative integers nums. For each integer in nums, you must find its respective second greater integer. The second greater integer of nums...

Next Greater Element III

Problem Description Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer ex...

Next Greater Element II

Problem Description Given a circular integer array nums (i.e., the next element of nums[nums.length - 1] is nums[0]), return the next greater number for every element in nums. The next greater num...

Next Greater Element I

Problem Description The next greater element of some element x in an array is the first greater element that is to the right of x in the same array. You are given two distinct 0-indexed integer ar...

Search a 2D Matrix II

Problem Description Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties: Integers in each row are sorted i...

Search a 2D Matrix

Problem Description Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties: Integers in each row are sorted f...

Permutation in String

This question is part of NeetCode150 series. PROBLEM DESCRIPTION Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if on...

Longest Repeating Character Replacement

This question is part of NeetCode150 series. Problem Description You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English...

All Subsets

This question is part of NeetCode150 series. Problem Description Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain dup...