Home
Priyanshu Tiwari
Cancel

September | 2022 | POTD GFG

02 | Minimum Cost to cut a board into squares A board of length $M$ and width $N$ is given. The task is to break this board into $M * N$ squares such that cost of breaking is minimum. The cutting ...

STL Cheat Sheet

pair utility container Used to store two data object in a single container #include <iostream> using namespace std int main(){ pair<int, int> p1; pair<int, int> p2(30...

Binary Trees | Striver’s A2Z DSA Course/Sheet

Step 13.1 Inorder Traversal Given the root of a binary tree, return the inorder traversal of its nodes’ values. Recursive Inorder traversal is Left -> Root -> Right. So, we will call...

Recursion | Striver’s SDE Sheet

Problem 1: Subset Sums Given a list arr of N integers, print sums of all subsets in it. Note: Return all the element is increasing order. Geeks For Geeks Brute class Solution { public: ...

Greedy | Striver’s SDE Sheet

Problem 1: N Meetings in a room Geeks For Geeks class Solution { public: int maxMeetings(int start[], int end[], int n) { pair<int, int> a[n + 1]; for(...

Linked List & Array | Striver’s SDE Sheet

Problem 1: Reverse a LinkedList Leetcode class Solution { public: ListNode* reverseList(ListNode* next) { ListNode* prev = NULL; while(next != NULL) { ...

Linked List II | Striver’s SDE Sheet

Problem 1: Reverse a LinkedList Leetcode class Solution { public: ListNode* reverseList(ListNode* next) { ListNode* prev = NULL; while(next != NULL) { ...

Linked List I | Striver’s SDE Sheet

Problem 1: Reverse a LinkedList Leetcode class Solution { public: ListNode* reverseList(ListNode* next) { ListNode* prev = NULL; while(next != NULL) { ...

Array IV | Striver’s SDE Sheet

Problem 1 Leetcode Brute This question has been updated on leetcode with newer constraints : -2^31 <= matrix[i][j] <= 2^31 - 1. Hence, we will have to use some extra space. class Solu...

Array III | Striver’s SDE Sheet

Problem 1 Leetcode Brute This question has been updated on leetcode with newer constraints : -2^31 <= matrix[i][j] <= 2^31 - 1. Hence, we will have to use some extra space. class Solu...

Trie | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...

Dynamic Programming II | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...

Dynamic Programming I | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...

Graph II | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...

Graph I | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...

Binary Tree IV | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...

Binary Search Tree II | Striver’s SDE Sheet

Problem 1: Floor in a BST You are given a BST (Binary search tree) with’ N’ number of nodes and a value ‘X’. Your task is to find the greatest value node of the BST which is smaller than or equal ...

Binary Search Tree I | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...

Array II | Striver’s SDE Sheet

Problem 1 Leetcode Brute This question has been updated on leetcode with newer constraints : -2^31 <= matrix[i][j] <= 2^31 - 1. Hence, we will have to use some extra space. class Solu...

Binary Tree III | Striver’s SDE Sheet

Problem 1: Reverse Words in a String You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or tra...