/CPP

My Data Structures and Algorithms preparation for Placements.

Primary LanguageC++

C++ Competitve Programming

Collection of the codes of Coding Block and geeksforgeeks Courses : C++ Fundamentals & C++ STL & C++ Interview Preparation & Fork CPP & PPC-1

Important Questions

S.No. Question Name Logic Used Type Date
1 Coin Change lower_bound(STL) Easy 18 Oct 20
2 Next Number Permutation next_permutation(STL) Easy 18 Oct 20
3 Max Activity Selection greedy, pair container Easy 18 Oct 20
4 Max Subarray Sum div and conq, pair container Medium 19 Oct 20
5 Key Sort Strings string tokenizer, sort, pair container Medium 21 Oct 20
6 Very Big Sort string, sort, compare Easy 21 Oct 20
7 Word Frequency map, stringstream Easy 30 Oct 20
8 Single occurence bit, xor Easy 30 Oct 20
9 count set bits bit, &, >> Easy 30 Oct 20
10 swap n bits binary bit, &, >>, xor Hard 30 Oct 20
11 subset sum = k powerset, &, << Medium 31 Oct 20
12 subsequences of given length powerset, set bits, &, << Hard 31 Oct 20
13 min chars del anagram map, abs difference Medium 31 Oct 20
14 pyramid pattern for loop Easy 02 Nov 20
15 square root babylonian algo Easy 13 Nov 20
16 0,1 pattern ternary operator, simple update Easy 13 Nov 20
17 dec to octal vector, for_each rev print Easy 13 Nov 20
18 simple calculator switch, signal 15 Easy 13 Nov 20
19 Ramu travel cost arrays Easy 14 Nov 20
20 pair sum arrays, 2 pointer approach Easy 14 Nov 20
21 remove duplicate chars arrays Easy 14 Nov 20
22 increasing-decreasing subseq arrays Medium 14 Nov 20
23 strict split array 2 vectors, sorting Easy 14 Nov 20
24 vector for custom class vectors, class, compare Easy 15 Nov 20
25 pythagorean triplet maths Medium 17 Nov 20
26 trailing zeroes factorial maths floor division Easy 20 Nov 20
27 interval point membership set of pair, upper_bound Easy 23 Nov 20
28 substring overlapping occurrence string find, string::npos Easy 01 Dec 20
29 sum pivot with one swap 2 maps and maths Medium 14 Dec 20
30 second largest in array 2 variables and swap Easy 14 Dec 20
31 pair sum with duplicate elements unordered_map, 2 pointer fails Easy 14 Dec 20
32 min Steps to 1 DP Easy 14 Dec 20
33 distinct pair sum in array map of pairs Medium 14 Dec 20
34 rotate array clockwise reverse 2 parts Easy 15 Dec 20
35 rotate array counter-clockwise Juggling Algo Medium 15 Dec 20
36 spiral matrix print 4 pointers, corner cases Easy 17 Dec 20
37 median row-wise sorted matrix binary search + upper_bound Medium 19 Dec 20
38 kth smallest in row-col sorted matrix binary search + staircase search Medium 20 Dec 20
39 cyclic binary search breakpoint parts + binary search Easy 22 Dec 20
40 book allocation monotonic search space Medium 23 Dec 20
41 max element in window size = k deque, sliding window technique Hard 27 Dec 20
42 vertical order print of binary tree queue, map, vector, recursion Hard 30 Dec 20
43 next greater element, circular array stack, traversal from right to left Medium 31 Dec 21
44 k largest elements minHeap of size k Easy 31 Dec 20
45 merge k sorted arrays minHeap and merge sort Medium 31 Dec 20
46 merge k sorted linked lists minHeap and merge sort Medium 01 Jan 21
47 recursively reverse linked list recursion and pointers Medium 09 Jan 21
48 kth node from end linked list fast, slow pointers Easy 09 Jan 21
49 cycle detection in linked list floyd, fast == slow Medium 09 Jan 21
50 median of 2 sorted arrays binary search, 4 variables Hard 10 Jan 21
51 palindrome linked list reverse from middle, compare Easy 13 Jan 21
52 unique non-repeating chars substr deque, sliding window Easy 20 Jan 21
53 level order traversal of binary tree height, recursion, kth print Medium 28 Jan 21
54 right view of binary tree NRL, new max level Medium 30 Jan 21
55 tree nodes at distance K from target node printAtLevel, ancestors U-turn Hard 31 Jan 21
56 max path sum in Binary Tree max branch_sum, max_sum from every node Hard 31 Jan 21
57 flatten a tree into sorted linked list postorder, return head and tail Hard 01 Feb 21
58 Heap Sort heapify, sort from right to left Easy 10 Feb 21
59 max xor pair using TRIE trie, left: 0, right: 0 Medium 13 Feb 21
60 max subarray xor using TRIE max xor pair in cumulative xor array Medium 13 Feb 21
61 count of rectangles using set set traversal, custom compare Easy 13 Feb 21
62 Sort strings based on keys stringstream, custom compare Easy 15 Feb 21
63 Expedition SPOJ sort, maxHeap, pick max fuel available Hard 20 Feb 21
64 Unique Zero Triplet Sum sorting, pair_sum 2 pointer approach Medium 24 Feb 21
65 4 Sum Unique reduce to 2 sum, edge cases Medium 27 Feb 21
66 fast power/ exponentiation recursion, bit masking Easy 27 Feb 21
66 K Sum generalized recursion, pair sum using 2 pointers Hard 28 Feb 21
67 minimize max diff in heights min, max value, cannot be negative Hard 05 March 21
68 Product array puzzle suffix array, prefix variable Easy 05 March 21
69 next permutation array find req index, find swap val, reverse from i + 1 Easy 05 March 21
70 Snakes and Ladders BFS, calculate next positions Hard 18 March 21
71 Segment Tree Sum Query update, query, vector representation Hard 19 April 21
72 Rare ASCII and Prime Factors sum of digits of prime factors Medium 28 April 21