Home
Priyanshu Tiwari
Cancel

Weekly and Biweekly Contests | November | Leetcode

Biweekly Contest 92 2481. Minimum Cuts to Divide a Circle A valid cut in a circle can be: A cut that is represented by a straight line that touches two points on the edge of the circle and pa...

Introductory Problems | CSES

Distinct Numbers You are given a list of n integers, and your task is to calculate the number of distinct values in the list. Problem #include <bits/stdc++.h> using namespace std;...

October | 2022 | POTD GFG

01 | Number of Distinct Islands Given a boolean 2D matrix grid of size $n /times m$. You have to find the number of distinct islands where a group of connected 1s (horizontally or vertically) form...

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(int i=0...

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