Home
Gaurav's GitHub Page
Cancel

Choose and Swap (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You are given a string str of lower case english alphabets. You can choose any two characters in the string and replace all the occurences of the first character with the secon...

Activity Selection (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given N activities with their start and finish day given in array start[ ] and end[ ]. Select the maximum number of activities that can be performed by a single person, assumin...

Page Faults in LRU (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION In operating systems that use paging for memory management, page replacement algorithm is needed to decide which page needs to be replaced when the new page comes in. Whenever ...

Minimum number of Coins (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given an infinite supply of each denomination of Indian currency { 1, 2, 5, 10, 20, 50, 100, 200, 500, 2000 } and a target value N. Find the minimum number of coins and/or note...

Largest number possible (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two numbers ‘N’ and ‘S’ , find the largest number that can be formed with ‘N’ digits and whose sum of digits should be equals to ‘S’. Return -1 if it is not possible. ge...

N meetings in one room (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You are given timings of n meetings in the form of (start[i], end[i]) where start[i] is the start time of meeting i and end[i] is the finish time of meeting i. Return the maxim...

Maximum Path Sum between 2 Special Nodes (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given a binary tree in which each node element contains a number. Find the maximum possible path sum from one special node to another special node. Note: Here special node is ...

Graph is Tree or Not (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION You are given an undirected graph of N nodes (numbered from 0 to N-1) and M edges. Return 1 if the graph is a tree, else return 0. Note: The input graph can have self-loops an...

Merge two BST's (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Given two BSTs, return elements of merged BSTs in sorted form. geeksforgeeks SOLUTION We can solve this by performing inorder traversals on both binary search trees to get s...

Serialize and deserialize a binary tree (geeksforgeeks - SDE Sheet)

PROBLEM DESCRIPTION Serialization is to store a tree in an array so that it can be later restored and deserialization is reading tree back from the array. Complete the functions serialize() : ...