Home
Gaurav's GitHub Page
Cancel

Number of pairs (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two positive integer arrays arr and brr, find the number of pairs such that xy > yx (raised to power of) where x is an element from arr and y is an element from brr. ...

Largest BST (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a binary tree. Find the size of its largest subtree which is a Binary Search Tree. Note: Here Size equals the number of nodes in the subtree. geeksforgeeks SOLUTION BR...

Merge Sort (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array arr[], its starting position l and its ending position r. Sort the array using merge sort algorithm. geeksforgeeks SOLUTION class Solution { void merge(in...

Find All Four Sum Numbers (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array A of integers and another number K. Find all the unique quadruple from the given array that sums up to K. Also note that all the quadruples which you return sho...

Quick Sort (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Quick Sort is a Divide and Conquer algorithm. It picks an element as a pivot and partitions the given array around the picked pivot. Given an array arr[], its starting position...

Maximize Toys (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an array arr[] of length N consisting cost of N toys and an integer K depicting the amount with you. Your task is to find maximum number of toys you can buy with K amount...

Anagram (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two strings a and b consisting of lowercase characters. The task is to check whether two given strings are an anagram of each other or not. An anagram of a string is anot...

Allocate Minimum Pages (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You have n books, each with arr[i] a number of pages. m students need to be allocated contiguous books, with each student getting at least one book. Out of all the permutations...

Maximum no of 1's row (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a boolean 2D array, where each row is sorted. Find the row with the maximum number of 1s. geeksforgeeks SOLUTION class Sol { public static int maxOnes (int mat[][]...

Find the element that appears once in sorted array (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a sorted array arr[] of size N. Find the element that appears only once in the array. All other elements appear exactly twice. geeksforgeeks SOLUTION class Solution { ...