Nothing Special   »   [go: up one dir, main page]

Skip to content

Here are the Solutions of the POTD & other problems in GFG

License

Notifications You must be signed in to change notification settings

apu52/GFG-Daily-Solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GFG-Daily-Solutions

Here Are the Solutions of the POTD & other problems in GFG

Day 1(14 JAN) : Find duplicate rows in a binary matrix

Day 2(15 JAN) : Grinding Geek

Day 3(16 JAN) : Sequence of Sequence

Day 4(17 JAN) : All Unique Permutations of an array

Day 5(18 JAN) : Water the plants

Day 6(19 JAN) : Top k numbers in a stream

Day 7(20 JAN) : Distribute candies in a binary tree

Day 8(21 JAN) : Vertex Cover

Day 9(22 JAN) : Paths from root with a specified sum

Day 10(23 JAN) : Course Schedule

Day 11(24 JAN) : Check if a given graph is tree or not

Day 12(25 JAN) : Shortest Prime Path

Day 13(26 JAN) : Fractional Knapsack

Day 14(27 JAN) : Brackets in Matrix Chain Multiplication

Day 15(28 JAN) : Geekina Hate 1s

Day 16(29 JAN) : Count digit groupings of a number

Day 17(30 JAN) : LCS of three strings

Day 18(31 JAN) : Insert and Search in a Trie

Day 19(1 FEB) : Panagram Checking

Day 20(2 FEB) : Implement Atoi

Day 21(3 FEB) : Decimal Equivalent of Binary Linked List

Day 22(4 FEB) : Subtraction in Linked List

Day 23(5 FEB) : Sorted insert for circular linked list

Day 24(6 FEB) : Node at distance

Day 25(7 FEB) : Min distance between two given nodes of a Binary Tree

Day 26(8 FEB) : Check if all leaves are at same level

Day 27(9 FEB) : Check for Children Sum Property in a Binary Tree

Day 28(10 FEB) : Number of paths in a matrix with k coins

Day 29(11 FEB) : Recamans sequence

Day 30(12 FEB) : Recursive sequence

Day 31(13 FEB) : Clone an Undirected Graph

Day 32(14 FEB) : Find all Critical Connections in the Graph

Day 33(15 FEB) : Count all Possible Path

Day 34(16 FEB) : Flatten BST to sorted list

Day 35(17 FEB) : Does array represent Heap

Day 36(18 FEB) : Sum of leaf nodes in BST

Day 37(19 FEB) : Game with String

Day 38(20 FEB) : Word Break

Day 39(21 FEB) : Boolean Parenthesization

Day 40(22 FEB) : Distinct occurrences

Day 41(23 FEB) : Buy and Sell a Share at most twice

Day 42(24 FEB) : Maximum Sum Problem

Day 43(25 FEB) : Reach a given score

Day 44(26 FEB) : Power Set

Day 45(27 FEB) : Play With OR

Day 46(28 FEB) : Check if a number is divisible by 8

Day 47(29 FEB) : Sum of bit differences

Day 48(03 MAR) : Largest Number formed from an Array

Day 49(04 MAR) : Swap the array elements

Day 50(05 MAR) : Maximum Index

Day 51(06 MAR) : Search Pattern (Rabin-Karp Algorithm)

Day 52(07 MAR) : Longest repeating and non-overlapping substring

Day 53(08 MAR) : Check if frequencies can be equal

Day 54(09 MAR) : Find the N-th character

Day 55(10 MAR) : Remove all duplicates from a given string

Day 56(11 MAR) : Count pairs Sum in matrices

Day 57(12 MAR) : Generalised Fibonacci numbers

Day 58(13 MAR) : Print matrix in diagonal pattern

Day 59(14 MAR) : Largest subsquare surrounded by X

Day 60(15 MAR) : Linked List that is Sorted Alternatingly

Day 61(16 MAR) : Delete without head pointer

Day 62(17 MAR) : Count Pairs whose sum is equal to X

Day 63(18 MAR) : Level order traversal

Day 64(19 MAR) : Possible Paths in a Tree

Day 65(20 MAR) : Sum of nodes on the longest path from root to leaf node

Day 66(21 MAR) : ZigZag Tree Traversal

Day 67(22 MAR) : Diagonal sum in binary tree

Day 68(23 MAR) : Fibonacci series up to Nth term

Day 69(24 MAR) : Insert an Element at the Bottom of a Stack

Day 70(25 MAR) : Print N-bit binary numbers having more 1s than 0s

Day 71(26 MAR) : Additive sequence

Day 72(27 MAR) : Find shortest safe route in a matrix

Day 73(28 MAR) : City With the Smallest Number of Neighbors at a Threshold Distance

Day 74(29 MAR) : Euler Circuit in an Undirected Graph

Day 75(30 MAR) : Minimum element in BST

Day 76(31 MAR) : Closest Neighbour in BST

Day 77(1 APR) : Pairs violating the BST property

Day 78(2 APR) : Minimum Absolute Difference In BST

Day 79(3 APR) : Kth common ancestor in BST

Day 80(4 APR) : Sum of all substrings of a number

Day 81(5 APR) : Strictly Increasing Array

Day 82(6 APR) : Count ways to N'th Stair

Day 83(7 APR) : Maximize dot product

Day 84(8 APR) : Optimal Strategy For A Game

Day 85(9 APR) : Minimum Points To Reach Destination

Day 86(10 APR) : Party of Couples

Day 87(11 APR) : Gray to Binary equivalent

Day 88(12 APR) : Sum of Products

Day 89(13 APR) : Reverse Bits

Day 90(14 APR) : Xoring and Clearing

Day 91(15 APR) : Count the elements

Day 92(16 APR) : Minimize the Difference

Day 93(17 APR) : Count Pairs in an Array

Day 94(18 APR) : Smallest String Starting From Leaf

Day 95(19 APR) : Find missing in second array

Day 96(20 APR) : Union of Two Sorted Arrays

Day 97(21 APR) : Three way partitioning

Day 98(22 APR) : Row with minimum number of 1's

Day 99(23 APR) : Rohan's Love for Matrix

Day 100(24 APR) : Paths to reach origin

Day 101(25 APR) : Maximum sum of hour glass

Day 102(26 APR) : Exit Point in a Matrix

Day 103(27 APR) : Merge Sort on Doubly Linked List

Day 104(28 APR) : Delete Middle of Linked List

Day 105(29 APR) : Remove every kth node

Day 106(30 APR) : Add two numbers represented by linked lists

Day 107(1 MAY) : Arrange Consonants and Vowels

Day 108(2 MAY) : Serialize and deserialize a binary tree

Day 109(3 MAY) : K distance from root

Day 110(4 MAY) : Construct Binary Tree from Inorder and Postorder

Day 111(5 MAY) : Vertical sum

Day 112(6 MAY) : Print all nodes that don't have sibling

Day 113(7 MAY) : Reverse Level Order Traversal

Day 114(8 MAY) : Root to Leaf Paths

Day 115(9 MAY) : Divisor Game

Day 116(10 MAY) : Combination Sum II

Day 117(11 MAY) : Juggler Sequence

Day 118(12 MAY) : Minimum steps to destination

Day 119(13 MAY) : Number of Good Components

Day 120(14 MAY) : Path With Minimum Effort

Day 121(15 MAY) : Account Merge

Day 122(16 MAY) : Divisibility tree

Day 123(17 MAY) : Find Pair Given Difference

Day 124(18 MAY) : Find the Highest number

Day 125(19 MAY) : Find the closest number

Day 126(20 MAY) : Modular Exponentiation for large numbers

Day 127(21 MAY) : K closest elements

Day 128(22 MAY) : Minimize Max Distance to Gas Station

Day 129(23 MAY) : K-Palindrome

Day 130(24 MAY) : Partitions with Given Difference

Day 131(25 MAY) : You and your books

Day 132(26 MAY) : Minimum Cost To Make Two Strings Identical

Day 133(27 MAY) : Longest subsequence-1

Day 134(28 MAY) : Minimum cost to fill given weight in a bag

Day 135(29 MAY) : Geek and its Game of Coins

Day 136(30 MAY) : String Subsequence

Day 137(31 MAY) : Swap two nibbles in a byte

Day 138(1 JUN) : Odd Even Problem

Day 139(2 JUN) : Construct list using given q XOR queries

Day 140(3 JUN) : Trail of ones

Day 141(4 JUN) : Binary representation of next number

Day 142(5 JUN) : Swapping pairs make sum equal

Day 143(6 JUN) : Max sum in the configuration

Day 144(7 JUN) : Maximum occured integer

Day 145(8 JUN) : Index of an Extra Element

Day 146(9 JUN) : Convert array into Zig-Zag fashion

Day 147(10 JUN) : Nuts and Bolts Problem

Day 148(11 JUN) : Maximum Tip Calculator

Day 149(12 JUN) : Count numbers containing 4

Day 150(13 JUN) : Padovan Sequence

Day 151(14 JUN) : Armstrong Numbers

Day 152(15 JUN) : Mobile numeric keypad

Day 153(16 JUN) : Prime Pair with Target Sum

Day 154(18 JUN) : Number of Rectangles in a Circle

Day 155(19 JUN) : Find maximum volume of a cuboid

Day 156(20 JUN) : Integral Points Inside Triangle

Day 157(21 JUN) : Compare two fractions

Day 158(22 JUN) : Extract the Number from the String

Day 159(23 JUN) : Print Bracket Number

Day 160(24 JUN) : Summed Matrix

Day 161(25 JUN) : Left Rotate Matrix K times

Day 162(26 JUN) : Coverage of all Zeros in a Binary Matrix

Day 163(27 JUN) : Toeplitz matrix

Day 164(28 JUN) : The Palindrome Pattern

Day 165(1 JUL) : Make Binary Tree From Linked List

Day 166(2 JUL) : Linked list of strings forms a palindrome

Day 167(3 JUL) : Remove all occurences of duplicates in a linked list

Day 168(4 JUL) : Duplicate Subtrees

Day 169(5 JUL) : Vertical Width of a Binary Tree

Day 170(6 JUL) : Populate Inorder Successor for all nodes

Day 171(12 JUL) : Root to leaf path sum

Day 172(13 JUL) : Shortest Path in Weighted undirected graph

Day 173(14 JUL) : Segregate 0s and 1s

Day 174(15 JUL) : Smallest number

Day 175(16 JUL) : Remaining String

Day 176(17 JUL) : Construct Binary Tree from Parent Array

Day 177(18 JUL) : Longest alternating subsequence

Day 178(19 JUL) : Count Smaller elements

Day 179(20 JUL) : Remove Half Nodes

Day 180(21 JUL) : Maximum product subset of an array

Day 181(22 JUL) : Largest BST

Day 182(23 JUL) : Merge two BST 's

Day 183(24 JUL) : Check for BST

Day 184(25 JUL) : Array to BST

Day 185(26 JUL) : K-Pangrams

Day 186(27 JUL) : Form a palindrome

Day 187(28 JUL) : Remove Duplicates

Day 188(29 JUL) : Row with max 1s

Day 189(30 JUL) : Rat in a Maze Problem - I

Day 190(31 JUL) : Longest Common Prefix of Strings

Day 191(1 AUG) : Spirally traversing a matrix

Day 192(2 AUG) : Edit Distance

Day 193(3 AUG) : The Celebrity Problem

Day 194(4 AUG) : N meetings in one room

Day 195(5 AUG) : Bottom View of Binary Tree

Day 196(6 AUG) : Validate an IP Address

Day 197(7 AUG) : K-th element of two Arrays

Day 198(8 AUG) : Sum Tree

Day 199(9 AUG) : Maximize Array Value After Rearrangement

Day 200(10 AUG) : Rotate a Linked List

Day 201(11 AUG) : Job Sequencing Problem

Day 202(12 AUG) : Sum of Middle elements of two sorted arrays

Day 203(13 AUG) : Square root of a number

Day 204(14 AUG) : Longest Common Substring

Day 205(15 AUG) : Add 1 to a Linked List Number

Day 206(16 AUG) : Maximize The Cut Segments

Day 207(17 AUG) : Product array puzzle

Day 208(18 AUG) : Split an array into two equal Sum subarrays

Day 209(19 AUG) : Kth Smallest

Day 210(20 AUG) : Burning Tree

Day 211(21 AUG) : Shortest path in Undirected Graph

Day 212(22 AUG) : Alien Dictionary

Day 213(23 AUG) : Left View of Binary Tree

Day 214(24 AUG) : 0 - 1 Knapsack Problem

Day 215(25 AUG) : Number of pairs

Day 216(26 AUG) : Wildcard Pattern Matching

Day 217(27 AUG) : Maximum Difference

Day 218(28 AUG) : Sorting Elements of an Array by Frequency

Day 219(29 AUG) : Find length of Loop

Day 220(30 AUG) : N-Queen Problem

Day 221(31 AUG) : Sorted subsequence of size 3

Day 222(1 SEPT) : Max sum path in two arrays

Day 223(2 SEPT) : Minimum Cost Path

Day 224(3 SEPT) : Minimum number of deletions and insertions

Day 225(4 SEPT) : Count ways to N'th Stair(Order does not matter)

Day 226(5 SEPT) : Missing in Array

Day 227(6 SEPT) : Kadane's Algorithm

Day 228(7 SEPT) : Nth Natural Number

Day 229(8 SEPT) : Minimum Jumps

Day 230(9 SEPT) : Sort 0s, 1s and 2s

Day 231(10 SEPT) : Circle of strings

Day 232(11 SEPT) : Minimum Cost of ropes

Day 233(12 SEPT) : Middle of a Linked List

Day 234(13 SEPT) : Mirror Tree

Day 235(14 SEPT) : Alternate positive and negative numbers

Day 236(15 SEPT) : Binary Tree to DLL

Day 237(16 SEPT) : Longest valid Parentheses

Day 238(17 SEPT) : Minimize the Heights II

Day 239(18 SEPT) : Parenthesis Checker

Day 240(19 SEPT) : Reverse Words

Day 241(20 SEPT) : Facing the sun

Day 242(21 SEPT) : Clone a linked list with next and random pointer

Day 243(22 SEPT) : Longest Prefix Suffix

Day 244(23 SEPT) : Missing And Repeating

Day 245(24 SEPT) : Smallest window in a string containing all the characters of another string

Day 246(25 SEPT) : Palindrome Linked List

Day 247(26 SEPT) : Roof Top

Day 248(27 SEPT) : K Sized Subarray Maximum

Day 249(28 SEPT) : Minimal Cost

Day 250(29 SEPT) : Total count

Day 251(30 SEPT) : Merge two BST 's(New Approach)

Day 252(01 OCT) : Multiply two linked lists

Day 253(02 OCT) : Rotate and delete

Day 254(03 OCT) : Majority Vote

Day 255(04 OCT) : Deletion and Reverse in Circular Linked List

Day 256(05 OCT) : Not a subset sum

Day 257(06 OCT) : Find the number of islands

Day 258(07 OCT) : XOR Linked List

Day 259(08 OCT) : Largest Pair Sum

Day 260(09 OCT) : Linked List Matrix

Day 261(10 OCT) : Max distance between same elements

Day 262(11 OCT) : Reorganize The Array

Day 263(12 OCT) : Two Smallests in Every Subarray

Day 264(13 OCT) : Delete Alternate Nodes

Day 265(14 OCT) : Count Linked List Nodes

Day 266(15 OCT) : Subarray range with given sum

Day 267(16 OCT) : Two Swaps

Day 268(17 OCT) : Split Linked List Alternatingly

Day 269(18 OCT) : Single Number

Day 270(19 OCT) : Nearest multiple of 10

Day 271(20 OCT) : Sort a k sorted doubly linked list

Day 272(21 OCT) : Split the Array

Day 273(22 OCT) : Sub-arrays with equal number of occurences

Day 274(23 OCT) : Find the Sum of Last N nodes of the Linked List

Day 275(24 OCT) : Modify the Array

Day 276(25 OCT) : Alternative Sorting

Day 277(26 OCT) : Occurence of an integer in a Linked List

Day 278(27 OCT) : Triplet Family

Day 279(28 OCT) : Remove duplicates in array

Day 280(29 OCT) : Quick Sort on Linked List

Day 281(30 OCT) : Pairs with difference k

Day 282(31 OCT) : Insert in Sorted way in a Sorted DLL

Day 283(01 NOV) : Swap and Maximize

Day 284(02 NOV) : Kth distance

Day 285(03 NOV) : Is Linked List Length Even?

Day 286(04 NOV) : Find All Triplets with Zero Sum

Day 287(05 NOV) : Rotate by 90 degree

Day 288(06 NOV) : Root to leaf paths sum

Day 289(07 NOV) : Split array in three equal sum subarrays

Day 290(08 NOV) : Minimum repeat to make substring

Day 291(09 NOV) : Minimum sum

Day 292(10 NOV) : Union of Two Sorted Arrays with Distinct Elements

Day 293(11 NOV) : Make array elements unique

Day 294(12 NOV) : Meeting Rooms

Day 295(13 NOV) : Intersection Point in Y Shaped Linked Lists

Day 296(14 NOV) : Nearly sorted

Day 297(15 NOV) : Second Largest

Day 298(16 NOV) : Move All Zeroes to End

Day 299(17 NOV) : Reverse an Array

Day 300(18 NOV) : Rotate Array

Day 301(19 NOV) : Next Permutation

Day 302(20 NOV) : Majority Element II

Day 303(21 NOV) : Stock Buy and Sell – Multiple Transaction Allowed

Day 304(22 NOV) : Stock Buy and Sell – Max one Transaction Allowed