Home
Gaurav's GitHub Page
Cancel

Minimum Number of Squares

Problem Description Given an integer A. Return minimum count of numbers, sum of whose squares is equal to A. Solution public class Solution { public int countMinSquares(int A) { int...

Fibonacci Number

Problem Description Given a positive integer A, write a program to find the Ath Fibonacci number. In a Fibonacci series, each term is the sum of the previous two terms and the first two terms of ...

Stairs

Problem Description You are climbing a staircase and it takes A steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Return the ...

Combination Sum II

Problem Description Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target. Each n...

Subsets II

Problem Description Given an integer array nums that may contain duplicates, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution ...

Subsets

Problem Description Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any or...

Combination Sum

Problem Description Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You m...

Permutations

Problem Description Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. leetcode Solution class Solution { List<List&...

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...